Need help coding the following reversal indicator
Forums › ProRealTime English forum › ProBuilder support › Need help coding the following reversal indicator
- This topic has 10 replies, 4 voices, and was last updated 5 years ago by Vonasi.
-
-
04/07/2017 at 1:03 PM #31365
High,
I’m looking for someone to help me code the following strategy. My version doesn’t work that well and need experience coder’s help
long position rules
- Red/Green candle (reversal)
- Bullish candle close above the open of the previous red candle
- Space to the left (the low of the last 3 candles lower than the low of the last 50 candles)
- default stochastic (8,3,3) was in the oversold area within the last 3 candles
Short Position rules
- Green/Red candle (reversal)
- Bearish candle close below the close of the previous green candle
- Space to the left (the high of the last 3 candles higher than the high of the last 50 candles)
- 4. default stochastic (8,3,3) was in the overbought area within the last 3 candles.
I’ve attached a bearish chart with annotation to help
04/07/2017 at 2:09 PM #3137404/07/2017 at 3:10 PM #3138704/07/2017 at 3:55 PM #31394Nice setups. Variables will return 1 for long, 1 for short, 0 for no signal. I added arrows on chart, examples attached. Here is the code. I might push it into the library too.
123456789101112131415161718192021222324252627282930313233343536373839//Nicolas @ prorealcode.com//reversal indicator//https://www.prorealcode.com/topic/need-help-coding-the-following-reversal-indicator/// LONG//Red/Green candle (reversal)//Bullish candle close above the open of the previous red candle//Space to the left (the low of the last 3 candles lower than the low of the last 50 candles)//default stochastic (8,3,3) was in the oversold area within the last 3 candlessto = stochastic[8,3]c1 = close[1]<open[1] and close>openc2 = close>open[1]c3 = lowest[3](low)<lowest[50](low)[1] or lowest[3](low)<lowest[50](low)[2] or lowest[3](low)<lowest[50](low)[3]c4 = summation[3](sto<20)>0long = c1 and c2 and c3 and c4if long thendrawarrowup(barindex,lowest[3](low)) coloured(0,255,0)endif// SHORT//Green/Red candle (reversal)//Bearish candle close below the close of the previous green candle//Space to the left (the high of the last 3 candles higher than the high of the last 50 candles)//default stochastic (8,3,3) was in the overbought area within the last 3 candles.c5 = close[1]>open[1] and close<openc6 = close<close[1]c7 = highest[3](high)>highest[50](high)[1] or highest[3](high)>highest[50](high)[2] or highest[3](high)>highest[50](high)[3]c8 = summation[3](sto>80)>0short = c5 and c6 and c7 and c8if short thendrawarrowdown(barindex,highest[3](high)) coloured(255,0,0)endifreturn long as "long reversal", short as "short reversal"04/07/2017 at 6:14 PM #3140004/07/2017 at 6:38 PM #31401Hi Nicolas,
Spotted a small error in the code i think as it wasn’t fully detecting the right bearish signals. Line 30 should be changed to:
close<open[1]
as the current close isn’t checked to ensure its lower than the previous open.:
04/07/2017 at 6:56 PM #31402Bearish candle close below the close of the previous green candle
Not an error, it’s as described 🙂
04/09/2017 at 9:36 AM #31474The indicator with the modification about the line 30 is now available in the code library: market reversal point indicator
03/19/2019 at 10:10 PM #94090Bonsoir Nicolas,
Je reçois un message d’erreur lorsque je valide la création de cet indicateur en faisant une copie des lignes de code
Je vous mets en pièce jointe la capture de la notification de l’erreur
Merci
03/19/2019 at 10:16 PM #94093Désolée – j’ai résolu le problème
03/19/2019 at 10:51 PM #94095Marie-Eve Vergoz – English only in the English forums please.
-
AuthorPosts
Find exclusive trading pro-tools on