How to build a RSI Range
Forums › ProRealTime English forum › ProOrder support › How to build a RSI Range
- This topic has 3 replies, 2 voices, and was last updated 3 years ago by robertogozzi.
Tagged: break out, BreakOut, range, RSI, rsi break out, rsi breakout, rsi range
-
-
03/25/2021 at 11:58 PM #165359
Good evening, I just have a question from a scretched idea from Yesterday (see screenshot). I want to try to build an RSI Range System which Make a box Range including the incomming “crossesbelow 30” or “crossesabove 70” till “crossesabove 30” or “crossesbelow 70” candle?
…
After that happend it should place a Stop Buy and Stop Sell (OCO) a bit over the range, so the Market can decide the direction. A bit like an open Range Breakout but just with the RSI range. After buy or sell order was activated, the stop should be at the low or high of the range with an 1% or 0,5% Moneymanagement. The Profit should be the half or 1:1 of the Range. I haven’t programmed anything for this yet. At first it’s just thoughts.
03/26/2021 at 1:46 AM #165361There you go:
RSI Range BeakOut1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465// X = crosses// b = below// a = above// OS = OverSold// OB = OverBought//// XbOS = Crosses Below OverSold// XaOS = Crosses Above OverSold// XbOB = Crosses Below OverBought// XaOB = Crosses Above OverBought//DEFPARAM CumulateOrders = FALSEOffset = 1 * PipSize //1 pip above MaxRange/below MinRangeOB = 70 //70 - 30 OverBought & OverSold tresholdsOS = 100 - OBMyRSI = Rsi[14](close) //14 periodsXbOS = MyRsi Crosses Under OSXaOS = MyRsi Crosses Over OSXbOB = MyRsi Crosses Under OBXaOB = MyRsi Crosses Over OBIF XbOS or XaOB THENGoShort = 0GoLong = 0Entry = 0SL = 0TP = 0MaxRange = highMinRange = lowENDIFMaxRange = max(MaxRange,high)MinRange = min(MinRange,low)// exit LONGIF LongOnMarket AND XaOB THENSELL AT MarketENDIF// exit SHORTIF ShortOnMarket AND XbOS THENEXITSHORT AT MarketENDIF// enter LONGIF XaOS THENGoShort = 0GoLong = 1Entry = MaxRange + OffsetSL = abs(Entry - MinRange)TP = abs(MaxRange - MinRange) / 2ENDIFIF GoLong AND Not LongOnMarket THENBUY 1 Contract AT Entry STOPSET TARGET PROFIT TPSET STOP LOSS SLENDIF// enter SHORTIF XbOB THENGoShort = 1GoLong = 0Entry = MinRange - OffsetSL = abs(Entry - MinRange)TP = abs(MaxRange - MinRange) / 2ENDIFIF GoShort AND Not ShortOnMarket THENSELLSHORT 1 Contract AT Entry STOPSET TARGET PROFIT TPSET STOP LOSS SLENDIF03/27/2021 at 11:15 PM #165519Hi robertogozzi, thank you very much. That was fast. The code does something, but sometimes it does something else. I can’t say exactly what it does (see screenshot, after the second box). There are some trades that I can’t explain. I draw a box from the RSI range to see, if the price breaks out of the high or low of this Range. Or do I have to change something in lines 22 to 26?
03/28/2021 at 12:55 AM #165524I added some code to clear data when OnMarket and I also apopended some debugging instructions to help you better identify Entry price, ST, TP and other variables using GRAPH and GRAPHONPRICE:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899// X = crosses// b = below// a = above// OS = OverSold// OB = OverBought//// XbOS = Crosses Below OverSold// XaOS = Crosses Above OverSold// XbOB = Crosses Below OverBought// XaOB = Crosses Above OverBought//DEFPARAM CumulateOrders = FALSEOffset = 1 * PipSize //1 pip above MaxRange/below MinRangeOB = 70 //70 - 30 OverBought & OverSold tresholdsOS = 100 - OBMyRSI = Rsi[14](close) //14 periodsXbOS = MyRsi Crosses Under OSXaOS = MyRsi Crosses Over OSXbOB = MyRsi Crosses Under OBXaOB = MyRsi Crosses Over OB//IF OnMarket OR StrategyProfit <> StrategyProfit[1] THENXaOB = 0XbOB = 0XaOS = 0XbOS = 0MaxRange = 0MinRange = 0Entry = 0GoShort = 0GoLong = 0ENDIF//IF XbOS or XaOB THENGoShort = 0GoLong = 0Entry = 0SL = 0TP = 0MaxRange = highMinRange = lowENDIFMaxRange = max(MaxRange,high)MinRange = min(MinRange,low)// exit LONGIF LongOnMarket AND XaOB THENSELL AT MarketENDIF// exit SHORTIF ShortOnMarket AND XbOS THENEXITSHORT AT MarketENDIF// enter LONGIF XaOS AND (MaxRange > 0) AND (MinRange > 0) THENGoShort = 0GoLong = 1Entry = MaxRange + OffsetSL = abs(Entry - MinRange)TP = abs(MaxRange - MinRange) / 2ENDIFIF GoLong AND Not LongOnMarket THENBUY 1 Contract AT Entry STOPSET TARGET PROFIT TPSET STOP LOSS SLENDIF// enter SHORTIF XbOB AND (MaxRange > 0) AND (MinRange > 0) THENGoShort = 1GoLong = 0Entry = MinRange - OffsetSL = abs(Entry - MinRange)TP = abs(MaxRange - MinRange) / 2ENDIFIF GoShort AND Not ShortOnMarket THENSELLSHORT 1 Contract AT Entry STOPSET TARGET PROFIT TPSET STOP LOSS SLENDIF/////////////////////////////////////////////////////////////////////////////GraphOnPrice EntryAA = TPBB = SLIF LongOnMarket THENGraphOnPrice TradePrice + AA coloured(0,0,255,255) AS "TP"GraphOnPrice TradePrice - BB coloured(255,0,0,255) AS "SL"ELSIF ShortOnMarket THENGraphOnPrice TradePrice - AA coloured(0,0,255,255) AS "TP"GraphOnPrice TradePrice + SL coloured(255,0,0,255) AS "SL"ELSEGraphOnPrice close coloured(0,0,0,0)GraphOnPrice close coloured(0,0,0,0)ENDIFgraph XaOBgraph XbOBgraph XaOSgraph XbOSgraph LongOnMarketgraph ShortOnMarket/////////////////////////////////////////////////////////////////////////////You may also want to add this indicator to your chart to highlight periods within OverBought and OverSold periods and plot a rectangle around MaxRange and MinRange:
123456789101112131415161718192021222324252627282930313233343536373839404142Offset = 1 * PipSize //1 pip above MaxRange/below MinRangeOB = 70 //70 - 30 OverBought & OverSold tresholdsOS = 100 - OBMyRSI = Rsi[14](close) //14 periodsXbOS = MyRsi Crosses Under OSXaOS = MyRsi Crosses Over OSXbOB = MyRsi Crosses Under OBXaOB = MyRsi Crosses Over OBIF XbOS or XaOB THENMaxRange = highMinRange = lowBar1 = BarIndexENDIFIF XaOS OR XbOB THENBar2 = BarIndex[1]DrawRectangle(Bar1,MaxRange+Offset,Bar2,MinRange-Offset) coloured(0,0,255,20) bordercolor(255,0,0,255)ELSEMaxRange = max(MaxRange,high)MinRange = min(MinRange,low)ENDIFONCE r = 0ONCE g = 0ONCE b = 0ONCE t = 0IF XaOB THENr = 0g = 255 //GREENb = 0t = 20ELSIF XbOS THENr = 255 //REDg = 0b = 0t = 20ELSIF XbOB OR XaOS THENr = 255 //WHITEg = 255b = 255t = 255ENDIFBackGroundColor(r,g,b,t)RETURN -
AuthorPosts
Find exclusive trading pro-tools on