myST = Supertrend[3,10]
Green = close > myST
IF Green AND Not OnMarket THEN
BUY 1 Contract at Market
SET STOP pLOSS 400
SET TARGET pPROFIT 800
ENDIF
// ATR Trailing Stop
//
TrailStart = 30
IF Not OnMarket THEN
Atr = averagetruerange[14](close) * 2
StopLossL = close + Atr
StopLossS = close - Atr
ExitPrice = 0
ENDIF
myProfit = PositionPrice * PositionPerf / PipSize
IF myProfit >= TrailStart * PipSize THEN
IF ExitPrice = 0 THEN
IF LongOnMarket THEN
ExitPrice = StopLossL
ELSIF ShortOnMarket THEN
ExitPrice = StopLossS
ENDIF
ENDIF
IF LongOnMarket AND close > (ExitPrice + Atr + (TrailStart * PipSize)) THEN
ExitPrice = ExitPrice + Atr
ELSIF ShortOnMarket AND close < (ExitPrice - Atr - (TrailStart * PipSize)) THEN
ExitPrice = ExitPrice - Atr
ENDIF
ENDIF
IF LongOnMarket AND (ExitPrice > 0) THEN
SELL AT ExitPrice STOP
ELSIF ShortOnMarket AND (ExitPrice > 0) THEN
EXITSHORT AT ExitPrice STOP
ENDIF
//graphonprice StopLossL coloured("Green",255)
//graphonprice StopLossS coloured("Blue",255)
//graph myProfit