Below/Above Trendline
Forums › ProRealTime English forum › ProBuilder support › Below/Above Trendline
- This topic has 9 replies, 5 voices, and was last updated 1 year ago by Zigo.
-
-
12/31/2022 at 11:20 AM #206568
I would like to know if it is possible to generate signal depending on if price is below or above a trendline
and how would i convert that into code.
i have attached a picture of what im looking for.
ofcourse it depends on how you calculate the Highs and lows etc..
12/31/2022 at 11:36 AM #20657012/31/2022 at 4:15 PM #206577It’s not possible to know about ojects drawn on the chart.
The solution is to calculate your own trendline.
I will code something asap.
1 user thanked author for this post.
01/29/2023 at 1:11 PM #208644Sorry for the long delay 😔, but I couldn’t write the code you need. I’ll be busy for the next 3 weeks, but I’ll do it soon after.
02/25/2023 at 4:58 PM #210486Sorry for the delay.
I came up with this one:
12345678910111213DEFPARAM DrawOnLastBarOnly = trueONCE LB = 20 //20 LookBack periodsmyMax = max(open,close)myMin = min(open,close)IF BarIndex > (LB * 2) THENHH2 = highest[LB](myMax[1])LL2 = lowest[LB](myMin[1])HH1 = highest[LB](myMax[1+LB])LL1 = lowest[LB](myMin[1+LB])DrawSegment(BarIndex[LB*2],HH1,BarIndex,HH2) coloured("Green") style(line,2)DrawSegment(BarIndex[LB*2],LL1,BarIndex,LL2) coloured("Red") style(line,2)ENDIFRETURNit’s a starting point. Let me know if this is somewhat helpful.
04/18/2023 at 12:47 AM #21342404/19/2023 at 3:31 PM #213517You need to build affine function of the trendline and check if price is above/below of the current value of the function, example: https://www.prorealcode.com/topic/etendre-drawray-sur-x-barres/#post-137968
04/20/2023 at 9:30 AM #213537Line10 and 11 are different.12345678910111213DEFPARAM DrawOnLastBarOnly = trueONCE LB = n //20 LookBack periodsmyMax = max(open,close)myMin = min(open,close)IF BarIndex > (LB * 2) THENHH2 = highest[LB](myMax[1])LL2 = lowest[LB](myMin[1])HH1 = highest[LB](myMax[1+LB])LL1 = lowest[LB](myMin[1+LB])DrawSegment(BarIndex[LB*2],HH1,BarIndex+Lb,HH2) coloured("Green") style(line,2)DrawSegment(BarIndex[LB*2],LL1,BarIndex+Lb,LL2) coloured("Red") style(line,2)ENDIFRETURN04/20/2023 at 9:37 AM #21354004/20/2023 at 9:39 AM #213541 -
AuthorPosts
Find exclusive trading pro-tools on