Wedges based in Cycle Highs and Lows
Forums › ProRealTime English forum › ProBuilder support › Wedges based in Cycle Highs and Lows
- This topic has 13 replies, 2 voices, and was last updated 4 years ago by robertogozzi.
-
-
10/13/2020 at 2:00 PM #147294
I have programmed an indicator to define the Highs and Lows based on Cycles, made by the Stochastics. Of course you can use other oscilators as well. Just edit it in the programming.
The highs and lows will be confirmed after the cycle has closed. Now I would like to add an extended line connecting the last 2 highs and an extended line to connect the last 2 lows. It is a way to see when wedges start to show up. See the image.Another thing is that sometimes it doesn’t show me the high/low after the cycle has closed. When I edit the settings in the menu, which are only about the transparency of the vertical lines, it shows up, or after I have validated the indicator again. I don’t know why that happens.
Highs and Lows by Stochastic Cycles123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106// This indicator marks highs and lows based on the Stochastic cycleK = stochastic[5,2]D = average[3](K)sma50 = average[50]macdl = macdline[5,20,30]M = momentum[42]//start of cycle low looking for the lowest price and lowest MACD as long as Stochastic %D<50If D =< 50 and D[1] => 50 thenincyclelow = 1lowestprice2 = lowestpriceLowestprice = lowmacdlowest2 = macdlowestmacdlowest = macdlDlowest2 = DlowestDlowest = DMlowest2 = MlowestMlowest = Mendif//End of cycle lowIf D => 50 and D[1] < 50 thenincyclelow = 0endif//lowest macd and price in Stochastic cycle %D<50if incyclelow thenlowestprice = min(lowestprice, low)macdlowest = min(macdlowest, macdl)Dlowest = min(Dlowest, D)Mlowest = min(Mlowest, M)endif//what is the lowest price bar of this cycle?if lowestprice<>lowestprice[1] thenlowestpriceBar=barindexendifif macdlowest<>macdlowest[1] thenmacdlowestBar=barindexmacdlowestPrice=low-10*pointsizeendifif Dlowest<>Dlowest[1] thenDlowestBar = barindexendifif Mlowest<>Mlowest[1] thenMlowestBar = barindexendif//LONGif incyclelow = 0 thenDRAWSEGMENT(lowestpriceBar,lowestprice,lowestpriceBar,lowestprice-50) COLOURED(0,groen,0) STYLE(dottedline, 1)DRAWSEGMENT(lowestpriceBar,lowestprice,lowestpriceBar-4,lowestprice) COLOURED(300,0,0) STYLE(line, 3)endif//____________________________________________________________________________________________________________________//start of cycle high looking for the higestest price and higest MACD as long as Stochastic %D>50If D => 50 and D[1] =< 50 thenincyclehigh = 1highestprice2 = highestpriceHighestPrice = highmacdhighest2 = macdhighestmacdhighest = macdlDhighest2 = DhighestDhighest = DMhighest2 = MhighestMhighest = Mendif//End of cycle highIf D =< 50 and D[1] > 50 thenincyclehigh = 0endif//highest stoch and price in cycle highif incyclehigh thenhighestPrice = max(highestPrice, high)macdhighest = max(macdhighest, macdl)Mhighest = max(Mhighest, M)endif//what is the lowest price bar of this cycle?if highestprice<>highestprice[1] thenhighestpriceBar=barindexendifif macdhighest<>macdhighest[1] thenmacdhighestBar=barindexmacdhighestPrice=low-10*pointsizeendifif Dhighest<>Dhighest[1] thenDhighestBar=barindexendifif Mhighest<>Mhighest[1] thenMhighestBar = barindexendif//SHORTif incyclehigh = 0 thenDRAWSEGMENT(highestpriceBar,highestprice,highestpriceBar,highestprice+50) COLOURED(rood,0,0) STYLE(dottedline, 1)DRAWSEGMENT(highestpriceBar,highestprice,highestpriceBar-4,highestprice) COLOURED(0,300,0) STYLE(line, 3)endifreturn10/13/2020 at 2:04 PM #14729510/13/2020 at 2:23 PM #147298There are many variables missing or not defined.
Can you please post a full working code?
Eben better it would be attaching the ITF file.
Thank you 🙂
10/13/2020 at 3:03 PM #147301Ciao Roberto,
Here is the ITF file1 user thanked author for this post.
10/13/2020 at 3:06 PM #14730310/13/2020 at 3:13 PM #14730410/13/2020 at 4:23 PM #147315The code is still not working, many variables are not used.
When posting code, please make sure it’s fully functional! People may want to help you, but only if you help them not waste their time uselessly!
10/13/2020 at 4:32 PM #147316It is fully functional. I even checked it with Nicolas. And it works for me.
I know the MACD and the Momentum aren’t used, although they are described, but they are also not in the programming. The signals you get in the chart are Lows and Highs based on the Stochastic [5,2,3]. They show up in my chart. See the image I included.
Please let me know what doesn’t work for you.
I took out the unused parameters, so here again.10/13/2020 at 4:48 PM #14732010/13/2020 at 5:42 PM #147333I see it’s for v11.
What TF and instrument is the one in your pics?
What time is the unmarked low?
10/13/2020 at 6:08 PM #147335I use it on different time frames. This one is on EURUSD 200 ticks.
The unmarked low doesn’t stay unmarked, as I said, when I refresh the indicator by only open the indicator editor it marks it, or by making the whole indicator invisble first and then visible again. I don’t know why. So the dropp out in the image is allready working, but then a new one, mainly the last ones, sometimes don’t show up.10/13/2020 at 6:25 PM #147338I cannot see the missing LOW you are referring, what time was it?
Moreover, the candlesticks I see are pretty much different from yours, is that Spot EurUsd?
If I can’t replicate exactly your trades, I can’t help you.
10/13/2020 at 7:01 PM #147341Yes, it is Spot Eur Usd, 200 ticks.
Aren’t you able to see the horizontal green and red lines? These are the Highs (green) and the Lows (red) based on the stochastic cycles. Now I want 2 extended lines. The first one connects the last 2 Highs and the other one connects the last 2 Lows.
I have added a new dropp out this evening. You see the time bar 19:25:0710/15/2020 at 2:01 PM #147484To draw those lines (supported by v11 only), you need to use two slightly different copies, with different names, of the same indicator.
This is the same indicator as yours (ITF file attached, as well as a screenshot), but I commented out drawing red and green segments, then I added instructions to keep track of the last two green and red segment to draw those elongated lines at the end:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293DEFPARAM DrawOnLastBarOnly = trueONCE MyHigh1 = 0ONCE MyHigh2 = 0ONCE MyLow1 = 0ONCE MyLow2 = 0ONCE BarHigh1 = 0ONCE BarHigh2 = 0ONCE BarLow1 = 0ONCE BarLow2 = 0// This indicator marks highs and lows based on the Stochastic cycleK = stochastic[5,2]D = average[3](K)//start of cycle low looking for the lowest price and lowest MACD as long as Stochastic %D<50If D =< 50 and D[1] => 50 thenincyclelow = 1lowestprice2 = lowestpriceLowestprice = lowDlowest2 = DlowestDlowest = Dendif//End of cycle lowIf D > 50 and D[1] < 50 thenincyclelow = 0endif//lowest macd and price in Stochastic cycle %D<50if incyclelow thenlowestprice = min(lowestprice, low)Dlowest = min(Dlowest, D)endif//what is the lowest price bar of this cycle?if lowestprice<>lowestprice[1] thenlowestpriceBar=barindexendif//LONGif incyclelow = 0 thenif lowestpricebar <> BarLow1 thenMyLow2 = MyLow1BarLow2 = BarLow1MyLow1 = lowestPriceBarLow1 = lowestpriceBarENDIF//DRAWSEGMENT(lowestpriceBar,lowestprice,lowestpriceBar,lowestprice-50) COLOURED(0,50,0) STYLE(dottedline, 1)//DRAWSEGMENT(lowestpriceBar,lowestprice,lowestpriceBar-4,lowestprice) COLOURED(300,0,0) STYLE(line, 3)endif//____________________________________________________________________________________________________________________//start of cycle high looking for the higestest price and higest MACD as long as Stochastic %D>50If D => 50 and D[1] =< 50 thenincyclehigh = 1highestprice2 = highestpriceHighestPrice = highendif//End of cycle highIf D < 50 and D[1] > 50 thenincyclehigh = 0endif//highest stoch and price in cycle highif incyclehigh thenhighestPrice = max(highestPrice, high)endif//what is the lowest price bar of this cycle?if highestprice<>highestprice[1] thenhighestpriceBar=barindexendif//SHORTif incyclehigh = 0 thenif highestpricebar <> BarHigh1 thenMyHigh2 = MyHigh1BarHigh2 = BarHigh1MyHigh1 = highestPriceBarHigh1 = highestpriceBarENDIF//DRAWSEGMENT(highestpriceBar,highestprice,highestpriceBar,highestprice+50) COLOURED(50,0,0) STYLE(dottedline, 1)//DRAWSEGMENT(highestpriceBar,highestprice,highestpriceBar-4,highestprice) COLOURED(0,300,0) STYLE(line, 3)endifDrawRay(BarHigh2,MyHigh2,BarHigh1,MyHigh1) coloured(0,0,255,255)DrawRay(BarLow2 ,MyLow2, BarLow1, MyLow1) coloured(0,0,255,255)returnas to missing Red/Green segments, please let me know instrument, TF, date and time there should have been one.
-
AuthorPosts
Find exclusive trading pro-tools on