Hello,
I am a newbie in thinkscript. I started to work on a study in TOS to see how charts behave around Daily High. So I plotted the daily high on intraday chart. Then I decided to extend it to next 10 days. I tried to do it in a smart way using a short code using parameters. But could not do it. Therefore I just repeated 10 blocks of the same code. It worked for me for some time, but it is very laborious to make any change if I want to change the number of days etc.
Here is what I am trying to do,
1. I want the ability to extend the high to X number of days back and Y number of days forward. Both x and y should be the parameter(settings) values.
2. It should have ability to plot it both on Daily as well as intraday charts. If this choice is in settings, much better.
3. I want to have ability to plot horizontal lines across high only if the daily bar is a UP. Is it possible to make such a parameter, wher I can choose a either up or down bar.
Can any expert on this forum please guide me in this? I know you guys are super busy. But if you could find some time and help me, I will be obliged. It is very interesing study and I am really very excited to learn more about it. But it becomes frustrating when I try hard and yet can not do it. I am pasting my code below, which is obviously a bad code. 🙂
plot linehigh1 = high(period = “day” )[1];
linehigh1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
linehigh1.SetDefaultColor(Color.VIOLET);
plot linehigh2 = high(period = “day” )[2];
linehigh2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
linehigh2.SetDefaultColor(Color.VIOLET);
plot linehigh3 = high(period = “day” )[3];
linehigh3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
linehigh3.SetDefaultColor(Color.VIOLET);
plot linehigh4 = high(period = “day” )[4];
linehigh4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
linehigh4.SetDefaultColor(Color.VIOLET);
plot linehigh5 = high(period = “day” )[5];
linehigh5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
linehigh5.SetDefaultColor(Color.VIOLET);
plot linehigh6 = high(period = “day” )[6];
linehigh6.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
linehigh6.SetDefaultColor(Color.VIOLET);
plot linehigh7 = high(period = “day” )[7];
linehigh7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
linehigh7.SetDefaultColor(Color.VIOLET);
plot linehigh8 = high(period = “day” )[8];
linehigh8.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
linehigh8.SetDefaultColor(Color.VIOLET);
plot linehigh9 = high(period = “day” )[9];
linehigh9.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
linehigh9.SetDefaultColor(Color.VIOLET);
plot linehigh10 = high(period = “day” )[10];
linehigh10.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
linehigh10.SetDefaultColor(Color.VIOLET);
Here is the screen shot to show how it looks on the chart.
I request you to please help. Thanks in advance.
Like this:
Like Loading...
Go back and review your code. There are numerous errors. Just plain typos. We really are at our limits here in assisting you in the Q&A forum. Very difficult to pass code back and forth in comments. Sorry but there are limitations to what we can provide for free.
As to the extension of your lines. Stop trying to figure it out. Trust me when I say if there was a way I would have already figured it out. Been doing this 10 years. Not trying to say I know it all. I learn new things everyday and that’s what keeps me engaged in this stuff. Just saying what you are trying to do with these line extensions is impossible in this platform. Not difficult, not challenging… impossible.
Hello Pete,
I get your point. I trust you. For me, you are the authority! There is no point in wasting the time in searching for an ‘impossible’ answer! I have found my bug and fixed it. I am very happy with what I am seeing on my chart! A BIG THANK YOU. You are truely an amazing person, very kind hearted! Thank you!