Need help converting Dynamic StopLoss indicator

M

mo2020

New member
Hi everybody!

In this example we are following a position with Parabolic SAR indicator.

Each new candle will be updating STOPLOSS to the new Parabolic SAR position.

Rich (BB code):
REM INDICATOR
mySAR = SAR[0.02,0.02,0.2]

REM CONDITIONS
c1 = mySAR >= High
c2 = mySAR <= Low

IF Not OnMarket THEN
 IF c1 THEN
  BUY 1 CONTRACT AT mySAR STOP
 ENDIF
 IF c2 THEN
  SELLSHORT 1 CONTRACT AT mySAR STOP
 ENDIF
ENDIF

IF LongOnMarket THEN
 mySTOP = mySAR
  IF Close >= TradePrice(1) THEN
   mySTOP = mySAR
   SELL AT mySTOP STOP
  ELSE
   SELL AT mySTOP STOP
 ENDIF
ENDIF

IF ShortOnMarket THEN
 mySTOP = mySAR
  IF Close <= TradePrice(1) THEN
   mySTOP = mySAR
   EXITSHORT AT mySTOP STOP
  ELSE
   EXITSHORT AT mySTOP STOP
  ENDIF
ENDIF
 
Last edited by a moderator:

Top