Error

 Previous Topic Next Topic
 kkrishna79 #1 Posted : Tuesday, April 4, 2023 7:40:03 AM(UTC) Rank: MemberGroups: Registered, Registered Users, Unverified UsersJoined: 1/31/2009(UTC)Posts: 18Location: MumbaiThanks: 2 times I am trying to make and indicator based on time from one start date to a specifice number ahead. For example 1 Jan 2023 is start date + 29 days = 30 Jan 2023 (should plot on chart) This indicator i have madesd:=Input("DATE",1,31,1); sm:=Input("MONTH",1,12,01); sy:=Input("YEAR",1980,2100,2023);start:= sd=DayOfMonth() AND sm=Month() AND sy=Year();x:=BarsSince(start);If(x=0,1,0); If(x=29,1,0); Now this is plotting Bar count instead of Date count. I request all friends please help me to rectify my code if i am making any mistake in it. Thank you allkrishna
 Wanna join the discussion?! Login to your Discussions forum accountor Register a new forum account.
 MS Support #2 Posted : Thursday, April 6, 2023 2:45:28 PM(UTC) Rank: Advanced MemberGroups: Moderators, Registered, Registered Users, SubscribersJoined: 10/8/2010(UTC)Posts: 1,945Thanks: 88 timesWas thanked: 155 time(s) in 150 post(s) Originally Posted by: kkrishna79 I am trying to make and indicator based on time from one start date to a specifice number ahead. For example 1 Jan 2023 is start date + 29 days = 30 Jan 2023 (should plot on chart) This indicator i have madesd:=Input("DATE",1,31,1); sm:=Input("MONTH",1,12,01); sy:=Input("YEAR",1980,2100,2023);start:= sd=DayOfMonth() AND sm=Month() AND sy=Year();x:=BarsSince(start);If(x=0,1,0); If(x=29,1,0); Now this is plotting Bar count instead of Date count. I request all friends please help me to rectify my code if i am making any mistake in it. Thank you allkrishna Hello,The code looks to be correct based on number of bars. One thing to keep in mind is that the start date must be a valid trading date. For example, in the US January 1st is not a valid trading day, so if you use this as the Start Date it will not plot anything. If you use January 3rd 2023 then your indicator should plot.
 kkrishna79 #3 Posted : Wednesday, April 12, 2023 7:35:49 AM(UTC) Rank: MemberGroups: Registered, Registered Users, Unverified UsersJoined: 1/31/2009(UTC)Posts: 18Location: MumbaiThanks: 2 times Respected Sir/Madam,Yes it work on Number of Bars , but i want to plot on Number of Days. How can i do it . Number of days count is there in trading view, so trying it out in metastock.Kindly help .Regards,Krishna Originally Posted by: MS Support Originally Posted by: kkrishna79 I am trying to make and indicator based on time from one start date to a specifice number ahead. For example 1 Jan 2023 is start date + 29 days = 30 Jan 2023 (should plot on chart) This indicator i have madesd:=Input("DATE",1,31,1); sm:=Input("MONTH",1,12,01); sy:=Input("YEAR",1980,2100,2023);start:= sd=DayOfMonth() AND sm=Month() AND sy=Year();x:=BarsSince(start);If(x=0,1,0); If(x=29,1,0); Now this is plotting Bar count instead of Date count. I request all friends please help me to rectify my code if i am making any mistake in it. Thank you allkrishna Hello,The code looks to be correct based on number of bars. One thing to keep in mind is that the start date must be a valid trading date. For example, in the US January 1st is not a valid trading day, so if you use this as the Start Date it will not plot anything. If you use January 3rd 2023 then your indicator should plot.
 Users browsing this topic
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.