Rank: Member
Groups: Registered, Registered Users, Unverified Users Joined: 1/31/2009(UTC) Posts: 18 Location: Mumbai
Thanks: 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 made sd:=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 all krishna
|
|
|
|
Rank: Advanced Member
Groups: Moderators, Registered, Registered Users, Subscribers Joined: 10/8/2010(UTC) Posts: 1,960
Thanks: 91 times Was 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 made sd:=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 all krishna
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.
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Unverified Users Joined: 1/31/2009(UTC) Posts: 18 Location: Mumbai
Thanks: 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 made sd:=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 all krishna
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 |
Guest (Hidden)
|
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.