Nicolas

Stop Reversal indicator

Category: Indicators By: Nicolas Created: May 11, 2018, 7:48 AM
May 11, 2018, 7:48 AM
Indicators
13 Comments
Stop Reversal indicator

The indicator is pretty similar to a Supertrend but based on fixed steps with pips/points instead of multiple of ATR. The arrows plotted on the price chart are the reversal of this “supertrend”.
I added an option to display or not the line that show the trend and when the price is crossing it (showLine).
The “nPips” setting is the size in points/pips between the current close and the “stop and reverse” trend line. You should adapt it for the instrument and timeframe displayed on your chart.

//PRC_StopReversal | indicator
//09.05.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

// --- settings
nPips = 0.004
showLine = 0 //0= false ; 1= true
// --- end of settings

if( (Close[0] = PREV) ) then
 TrStopLevel=PREV
elsif( (Close[1])<PREV and (Close[0]<PREV)  ) then
 TrStopLevel=Min(PREV,Close[0]*(1+nPips))
else
 if( ((Close[1])>PREV) and (Close[0]>PREV) ) then
  TrStopLevel=Max(PREV,Close[0]*(1-nPips))
 else
  if( (Close[0]>PREV) ) then
   TrStopLevel=Close[0]*(1-nPips)
  else
   TrStopLevel=Close[0]*(1+nPips)
  endif
 endif
endif

if( Close[0] > TrStopLevel and  Close[1]<PREV and PREV <>0 ) then
 drawarrowup(barindex,TrStopLevel) coloured(0,255,0)
endif


if( Close[0] < TrStopLevel and  Close[1]>PREV  and PREV <>0 ) then
 drawarrowdown(barindex,TrStopLevel) coloured(255,0,0)
endif


PREV=TrStopLevel

myline=undefined
if showline then
 myline=PREV
endif

return myline

 

Download
Filename: PRC_StopReversal.itf
Downloads: 489
Download
Filename: stopreversal-indicator.png
Downloads: 142
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Nicolas
8 years ago
#

indicator1 = CALL “PRC_StopReversal”[npips, 1] and define npips in the optimization window with its start, end and step of variable increment, that's all :)

Geronima Ortiz
8 years ago
#

I watched the video three times, but I can not put the npips parameter as a variable. I do not understand how to change the code to do it. If you can help me I would be happy, otherwise it does not matter. Thank you

Geronima Ortiz
8 years ago
#

I think the video is for an old version of prorealtime, the images do not correspond at all to the current version. I abandoned the idea. Do not worry. That's okay. Thank for all

Geronima Ortiz
8 years ago
#

okay it seems to me that it works. I saw the video you reported to me, but I was not able to put NPIPS as a variable in order to optimize it. Can you help me please?

Nicolas
8 years ago
#

If you follow the video, it's easy as 1.2.3 :)

Geronima Ortiz
8 years ago
#

// Definizione dei parametri del codice DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate // Condizioni per entrare su posizioni long indicator1 = CALL "PRC_StopReversal"[0.004, 1] c1 = (close CROSSES OVER indicator1) IF c1 THEN BUY 1 CONTRACT AT MARKET ENDIF // Condizioni per uscire da posizioni long indicator2 = CALL "PRC_StopReversal"[0.004, 1] c2 = (close CROSSES UNDER indicator2) IF c2 THEN SELL AT MARKET ENDIF // Condizioni per entrare su posizioni short indicator3 = CALL "PRC_StopReversal"[0.004, 1] c3 = (close CROSSES UNDER indicator3) IF c3 THEN SELLSHORT 1 CONTRACT AT MARKET ENDIF // Condizioni per uscire da posizioni short indicator4 = CALL "PRC_StopReversal"[0.004, 1] c4 = (close CROSSES OVER indicator4) IF c4 THEN EXITSHORT AT MARKET ENDIF

Geronima Ortiz
8 years ago
#

I'm sorry to come back here, I can not transform your indicator into a trading system. can you help me? I believed that the simplified creation was useful for those like me who do not know anything about language, but no!

Nicolas
8 years ago
#

You should test crossing of close with the indicators line and not if it's above or below

Geronima Ortiz
8 years ago
#

// Definizione dei parametri del codice DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate // Condizioni per entrare su posizioni long indicator1 = CALL "PRC_StopReversal"[0.004, 1] c1 = (close >= indicator1) IF c1 THEN BUY 1 CONTRACT AT MARKET ENDIF // Condizioni per uscire da posizioni long indicator2 = CALL "PRC_StopReversal"[0.004, 1] c2 = (close <= indicator2) IF c2 THEN SELL AT MARKET ENDIF I was helped by the simplified creation I get this result, but it only works long. I would like to get the system to look for the best NPIPS. Can you help me? thank you

Nicolas
8 years ago
#

You can try to optimize values for instruments/timeframes, like it is explained in this video: https://www.prorealcode.com/blog/video-tutorials/how-to-optimize-a-trading-system-with-probacktest-prorealtime/

Geronima Ortiz
8 years ago
#

Thanks, Nicolas is it possible to create a trading system with this indicator? I tried but I could not do it Hello

Nicolas
8 years ago
#

Yes of course, be sure to set 'showline=1'. In your trading system, just test if the Close is crossing over or under the black line (variable name = myline). Just like what we do with a usual Supertrend for instance.

Geronima Ortiz
8 years ago
#

Grazie Nicolas, è possibile creare un sistema di trading con questo indicatore? Ho provato ma non ci sono riuscita Ciao

ProRealCode ProRealCode
Loading...