DEFPARAM CumulateOrders = true
DEFPARAM FlatAfter = 172959
HeureDebut = 090000
HeureFin = 172959
Plage = (time >= HeureDebut AND time <= HeureFin)
//Entrée LONG
ch = close > open //chandelier haussier
IF NOT SHORTONMARKET AND ch AND Plage THEN
IF LONGONMARKET THEN
SELL AT MARKET
BUY 1 contract AT MARKET NextBarOpen
op = open
TPL = TradePrice //TradePrice Long
PrixStopL = (TPL - (TPL*0.0015))
IF (TPL - op) > (TPL*0.0009) THEN
SET STOP PRICE op
ELSIF (TPL - op) < (TPL*0.0009) THEN
SET STOP PRICE PrixStopL
ENDIF
ELSIF NOT LONGONMARKET THEN
BUY 1 contract AT MARKET NextBarOpen
op = open
TPL = TradePrice //TradePrice Long
PrixStopL = (TPL - (TPL*0.0015))
IF (TPL - op) > (TPL*0.0009) THEN
SET STOP PRICE op
ELSIF (TPL - op) < (TPL*0.0009) THEN
SET STOP PRICE PrixStopL
ENDIF
ENDIF
ENDIF
IF LONGONMARKET AND ch AND Plage THEN
SELL AT close LIMIT
ENDIF
//cl = close > TPL //clôture Long
//==========================================
//Entrée SHORT
cb = close < open
IF NOT LONGONMARKET AND cb AND Plage THEN
IF SHORTONMARKET THEN
EXITSHORT AT MARKET
SELLSHORT 1 contract AT MARKET NextBarOpen
op = open
TPS = TradePrice //TradePrice Short
PrixStopS = (TPS + (TPS*0.0015))
IF (op -TPS) > (TPL*0.0009) THEN
SET STOP PRICE op
ELSIF (op - TPS) < (TPL*0.0009) THEN
SET STOP PRICE PrixStopS
ENDIF
ELSIF NOT SHORTONMARKET THEN
SELLSHORT 1 contract AT MARKET NextBarOpen
op = open
TPS = TradePrice //TradePrice Short
PrixStopS = (TPS + (TPS*0.0015))
IF (op -TPS) > (TPL*0.0009) THEN
SET STOP PRICE op
ELSIF (op - TPS) < (TPL*0.0009) THEN
SET STOP PRICE PrixStopS
ENDIF
ENDIF
ENDIF
IF SHORTONMARKET AND cb AND Plage THEN
EXITSHORT AT close LIMIT
ENDIF
//cs = close < TPS //clôture Short