DEFPARAM CUMULATEORDERS = false
TIMEFRAME(5 Minute)
//Réinitialisation VALEUR
if Not OnMarket THEN
SLFinance = 0
//SL = 0
//TP1 = 0
//TP2 = 0
endif
niveau = 42400
Achat = open < niveau and close > niveau+2*pipsize
Vente = open > niveau and close < niveau+2*pipsize
if Achat and Not OnMarket then
// POUR UN ACHAT
//Ordre Achat
BUY 2 CONTRACT AT MARKET
SLFinance = 1
SLA = Close-abs(Close - Low)
TP1A = Close+2*(abs(Close-Low))
TP2A = Close+3*(abs(Close-Low))
SET STOP Price SLA
ELSIF Vente and Not OnMarket THEN
//Ordre VENTE
SELLSHORT 2 CONTRACT AT MARKET
SLFinance = 1
SLV = Close+abs(close - High)
TP1V = Close-2*(abs(Close-High))
TP2V = Close-3*(abs(Close-High))
SET STOP Price SLV
ENDIF
//SL et TP pour la position d'achat
if longonmarket and close >= TP1A and SLFinance = 1 then
sell abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET
set stop BREAKEVEN
SLFinance = 2
endif
//SL et TP pour la position de vente
If shortonmarket and close <= TP1V and SLFinance = 1 then
EXITSHORT abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET
set stop BREAKEVEN
SLFinance = 2
endif
GRAPHONPRICE SLV coloured("Red")
GRAPHONPRICE TP1V coloured("Blue")
GRAPHONPRICE TP2V coloured("GREEN")
GraphOnPrice 42400