defparam flatafter = 170000
defparam flatbefore = 090000
defparam CUMULATEORDERS = true
MySupport = highest[10](high)
MYRESISTANCE = lowest[10](low)
//
a = 12
b = 26
c = 9
sma = Average[200](close)
ma = MACDline[a,b,c](close)
signal=exponentialaverage[c](ma)
//moncapital = 10000
//mylot = (moncapital+strategyprofit)*0.01
//monlot = (mylot/1/10)
// Conditions pour ouvrir une position acheteuse
if dayofweek>=1 and dayofweek<=5 then
IF ma crosses over signal and ma < 0 and close > sma THEN
BUY 1 shares AT MARKET
set stop ploss close-MYRESISTANCE
set target Pprofit 2*(close-MYRESISTANCE)
ENDIF
// Conditions pour fermer une position acheteuse
IF LONGONMARKET THEN
SELL AT Market
ENDIF
// Conditions pour ouvrir une position en vente à découvert
IF ma crosses under signal and ma > 0 and close < sma THEN
SELLSHORT 1 shares AT MARKET
set stop ploss MySupport-close
set target pprofit 2*(MySupport-close)
ENDIF
// Conditions pour fermer une position en vente à découvert
IF SHORTONMARKET THEN
exitshort AT market
ENDIF
endif