Highs and Lows based on Stochastic Cycles
Forums › ProRealTime English forum › ProBuilder support › Highs and Lows based on Stochastic Cycles
- This topic has 16 replies, 6 voices, and was last updated 9 months ago by Madrosat.
-
-
10/02/2020 at 10:27 AM #146162
Hello,
I am busy with a indicator which marks the highs and lows of price based on the stochastic cycle, after the stochastic cycle has closed. A cyclehigh is where %D > 50 and a cyclelow is where %D < 50. I use EUR/USD.
I would like to have a Textsignal at the candle with the highest high when the Stochastic D > 50 and at the candle with the lowest low when the stochastics D < 50. And preferable that is tells me also if this highest high is higher or lower then the previous highest high from the previous cycle.I manage to program to define the highest high and lowest low, and also the previous highest high and lowest low but I only manage to show them as lines. That makes to much noise in my charts so I am looking for a way where I can mark ONLY the candles with the highest high and the lowest low in the cycle and preferable that is tells me also if this highest high is higher or lower then the previous highest high from the previous cycle.
So my challenge is in the part where I want to DrawText and define the candle where to do draw text. It needs to mark the highest high when the cycle high is over and not during the cycle high. And if the macd has made a lower high during that cycle high.
Highs n Lows price and macd in Stcoahastic Cycles12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667// This indicator marks highs and lows based of price and macd based on the Stochastic cycleK = stochastic[5,3]D = average[3](K)sma20 = average[20]macdl = macdline[5,20,30]//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 = macdlendif//End of cycle lowIf K => 50 and K[1] < 50 thenincyclelow = 0endif//lowest macd and price in Stochastic cycle %D<50if incyclelow thenlowestprice = min(lowestprice, low)macdlowest = min(macdlowest, macdl)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 = macdlendif//End of cycle highIf K < 50 and K[1] > 50 thenincyclehigh = 0endif//highest stoch and price in cycle highif incyclehigh thenhighestPrice = max(highestPrice, high)macdhighest = max(macdhighest, macdl)endif//LONGif incyclelow = 0 and lowestprice > lowestprice2 thenDRAWTEXT ("HLP", barindex, low-0.0008, Dialog, Bold, 10) COLOURED(0,0,0)endifif incyclelow = 0 and macdlowest > macdlowest2 thenDRAWTEXT ("HLM", barindex, low-0.0010, Dialog, Bold, 10) COLOURED(0,0,0)endif//SHORTif incyclehigh=0 and highestprice < highestprice2 thenDRAWTEXT ("LHP", barindex, high+0.0008, Dialog, Bold, 10) COLOURED(0,0,0)endifif incyclehigh =0 and macdhighest < macdhighest2 thenDRAWTEXT ("LHM", barindex, high+0.0010, Dialog, Bold, 10) COLOURED(0,0,0)endifreturn lowestprice as "lowest price in cycle low",macdlowest as "lowest macdline in cycle low", lowestprice2 as "previous lowest price in cycle low", macdlowest2 as "previous lowest macdline in cycle low", highestprice as "highest price in cycle high",macdhighest as "highest macdline in cycle high", highestprice2 as "previous highest price in cycle high", macdhighest2 as "previous highest macdline in cycle high"In my indicator you see the highs and lows and the previous highs and lows.
Red = lowest price
Purple = previous lowest price
Green = highest price
Light blue = previous highest price
The signal from theHH HL LL and LH from the macd can also be done in a seperate indicator if it isn’t possible to combine them, The thing with the MACD of course is that the visibilaty of the signal depends on waht you trade.10/02/2020 at 10:38 AM #14616710/02/2020 at 12:22 PM #146182I’m not sure of the complete picture of what you want to achieve, so I just modify the lowest (LONG) part of your code:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546// This indicator marks highs and lows based of price and macd based on the Stochastic cycleK = stochastic[5,3]D = average[3](K)//sma20 = average[20]macdl = macdline[5,20,30]//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 = macdlendif//End of cycle lowIf K => 50 and K[1] < 50 thenincyclelow = 0endif//lowest macd and price in Stochastic cycle %D<50if incyclelow thenlowestprice = min(lowestprice, low)macdlowest = min(macdlowest, macdl)//what is the lowest price bar of this cycle?if lowestprice<>lowestprice[1] thenlowestpriceBar=barindexendifif macdlowest<>macdlowest[1] thenmacdlowestBar=barindexmacdlowestPrice=low-10*pointsizeendifendif//LONGif incyclelow = 0 and lowestprice > lowestprice2 thenDRAWTEXT ("HLP", lowestpriceBar, lowestprice, Dialog, Bold, 20) COLOURED(255,200,0)endifif incyclelow = 0 and macdlowest > macdlowest2 thenDRAWTEXT ("HLM", macdlowestBar, macdlowestPrice, Dialog, Bold, 16) COLOURED(0,0,0)endifreturn //lowestprice as "lowest price in cycle low",macdlowest as "lowest macdline in cycle low", lowestprice2 as "previous lowest price in cycle low", macdlowest2 as "previous lowest macdline in cycle low"1 user thanked author for this post.
10/02/2020 at 12:36 PM #14618810/02/2020 at 2:59 PM #146200Thanks again Nicolas for helping me out describing the candle with the higherst high within the Stochastic cycle.
This indicator describes the Higher Lows and Lower Highs in Price and in Macd within the cycles of the Stochastics (Stochastics %D is my oscillator, but you can use others as well. Just needs a bit editing). It also marks the Highs with a green line and Lows with a red line in every cycle high and low with a red line.
HLP = Higher Low Price
HLM = Higher Low Macdline
LHP = Lower High Price
LHM = Lower High Macdline
-see the image-
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105// This indicator marks highs and lows based on the Stochastic cycleK = stochastic[5,3]D = average[3](K)sma20 = average[20]macdl = macdline[5,20,30]//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 = macdlendif//End of cycle lowIf K => 50 and K[1] < 50 thenincyclelow = 0endif//lowest macd and price in Stochastic cycle %D<50if incyclelow thenlowestprice = min(lowestprice, low)macdlowest = min(macdlowest, macdl)endif//what is the lowest price bar of this cycle?if lowestprice<>lowestprice[1] thenlowestpriceBar=barindexendifif macdlowest<>macdlowest[1] thenmacdlowestBar=barindexmacdlowestPrice=low-10*pointsizeendif//LONGif incyclelow = 0 and lowestprice > lowestprice2 thenDRAWTEXT ("HLP", lowestpriceBar, lowestprice-0.0008, Dialog, standard, 10) COLOURED(200,200,200)endifif incyclelow = 0 thenDRAWSEGMENT(lowestpriceBar,lowestprice,lowestpriceBar,lowestprice-50) COLOURED(100,0,0)endifif incyclelow = 0 and macdlowest > macdlowest2 thenDRAWTEXT ("HLM", lowestpriceBar, lowestprice-0.0011, Dialog, standard, 10) COLOURED(200,200,200)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 = macdl//what is the lowest price bar of this cycle?if lowestprice<>lowestprice[1] thenlowestpriceBar=barindexendifif macdlowest<>macdlowest[1] thenmacdlowestBar=barindexmacdlowestPrice=low-10*pointsizeendifendif//End of cycle highIf K =< 50 and K[1] > 50 thenincyclehigh = 0endif//highest stoch and price in cycle highif incyclehigh thenhighestPrice = max(highestPrice, high)macdhighest = max(macdhighest, macdl)endif//what is the lowest price bar of this cycle?if highestprice<>highestprice[1] thenhighestpriceBar=barindexendifif macdhighest<>macdhighest[1] thenmacdhighestBar=barindexmacdhighestPrice=low-10*pointsizeendif//SHORTif incyclehigh=0 and highestprice < highestprice2 thenDRAWTEXT ("LHP", highestpriceBar, highestprice+0.0008, Dialog, standard,10) COLOURED(1000,1000,1000)endifif incyclehigh = 0 thenDRAWSEGMENT(highestpriceBar,highestprice,highestpriceBar,highestprice+50) COLOURED(0,100,0)endifif incyclehigh =0 and macdhighest < macdhighest2 thenDRAWTEXT ("LHM", highestpriceBar, highestprice+0.0011, Dialog, standard, 10) COLOURED(1000,1000,1000)endifreturn1 user thanked author for this post.
10/02/2020 at 3:02 PM #14620210/25/2020 at 2:20 AM #14837310/25/2020 at 3:11 AM #14837410/25/2020 at 9:10 AM #14837810/25/2020 at 3:28 PM #14841810/26/2020 at 8:07 AM #148465Hello Fifi
It is not a problem of color, the code as it is above does
not work on 10 3.
I am looking for the most reliable reversal signals
I mainly test eur usd 1 hour, dear Fifi would you have an idea
on what works best.
This question I also ask Nicolas, Roberto, Paul, Nonetheles, Grahal and all of you ???10/29/2020 at 1:37 PM #14889610/29/2020 at 5:48 PM #148921123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105// This indicator marks highs and lows based on the Stochastic cycleK = stochastic[5,3]D = average[3](K)//sma20 = average[20]macdl = macdline[5,20,30]//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 = macdlendif//End of cycle lowIf K => 50 and K[1] < 50 thenincyclelow = 0endif//lowest macd and price in Stochastic cycle %D<50if incyclelow thenlowestprice = min(lowestprice, low)macdlowest = min(macdlowest, macdl)endif//what is the lowest price bar of this cycle?if lowestprice<>lowestprice[1] thenlowestpriceBar=barindexendifif macdlowest<>macdlowest[1] then//macdlowestBar=barindex//macdlowestPrice=low-10*pointsizeendif//LONGif incyclelow = 0 and lowestprice > lowestprice2 thenDRAWTEXT ("HLP", lowestpriceBar, lowestprice-0.0008, Dialog, standard, 10) COLOURED(200,200,200)endifif incyclelow = 0 thenDRAWSEGMENT(lowestpriceBar,lowestprice,lowestpriceBar,lowestprice-50) COLOURED(100,0,0)endifif incyclelow = 0 and macdlowest > macdlowest2 thenDRAWTEXT ("HLM", lowestpriceBar, lowestprice-0.0011, Dialog, standard, 10) COLOURED(200,200,200)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 = macdl//what is the lowest price bar of this cycle?if lowestprice<>lowestprice[1] thenlowestpriceBar=barindexendifif macdlowest<>macdlowest[1] then//macdlowestBar=barindex//macdlowestPrice=low-10*pointsizeendifendif//End of cycle highIf K =< 50 and K[1] > 50 thenincyclehigh = 0endif//highest stoch and price in cycle highif incyclehigh thenhighestPrice = max(highestPrice, high)macdhighest = max(macdhighest, macdl)endif//what is the lowest price bar of this cycle?if highestprice<>highestprice[1] thenhighestpriceBar=barindexendifif macdhighest<>macdhighest[1] then//macdhighestBar=barindex//macdhighestPrice=low-10*pointsizeendif//SHORTif incyclehigh=0 and highestprice < highestprice2 thenDRAWTEXT ("LHP", highestpriceBar, highestprice+0.0008, Dialog, standard,10) COLOURED(0,0,0)endifif incyclehigh = 0 thenDRAWSEGMENT(highestpriceBar,highestprice,highestpriceBar,highestprice+50) COLOURED(0,100,0)endifif incyclehigh =0 and macdhighest < macdhighest2 thenDRAWTEXT ("LHM", highestpriceBar, highestprice+0.0011, Dialog, standard, 10) COLOURED(0,0,0)endifreturn //lowestprice as "lowest price in cycle low",macdlowest as "lowest macdline in cycle low", lowestprice2 as "previous lowest price in cycle low", macdlowest2 as "previous lowest macdline in cycle low"modify
10/29/2020 at 8:07 PM #14893302/24/2024 at 8:54 AM #228676 -
AuthorPosts
Find exclusive trading pro-tools on