Bonjour Nicolas,
Mon bot a 5 stratégies “differentes” pour prendre position en achat.
J’aimerais configurer un break-even different par strategies.
exemple avec 2 stratagies differentes :
if L1 and Ltime and not onmarket then
buy nlot contract at market
SET STOP pLOSS 25
SET TARGET pPROFIT 75
endif
if L2 and Ltime and not onmarket then
buy nlot contract at market
SET STOP pLOSS 20
SET TARGET pPROFIT 60
endif
longbreakeven = 1
longbreakevenstart = 40
longbreakevenstep = 15
IF longbreakeven = 1 AND LONGONMARKET AND close - tradeprice(1) >= longbreakevenstart THEN
longBE = tradeprice(1) + longbreakevenstep
ENDIF
IF longBE > 0 THEN
SELL AT longBE STOP
ENDIF
IF NOT ONMARKET THEN
longBE = 0
ENDIF
Ce breakeven va s’activer de la meme facon pour les 2 strategies differentes et j’aimerais en configurer un different pour chacun des 2 stratégies.
Je pourrais ainsi faire de meme pour les 5 stratégies differentes.
Merci
Si la stratégie ne permet qu’à une seule de tes stratégies de fonctionner à la fois, alors tu peux tagger quelle stratégie est en cours en renseignant une variable au moment où tu passes ton ordre:
if L1 and Ltime and not onmarket then
buy nlot contract at market
SET STOP pLOSS 25
SET TARGET pPROFIT 75
strategie = 1
endif
if L2 and Ltime and not onmarket then
buy nlot contract at market
SET STOP pLOSS 20
SET TARGET pPROFIT 60
strategie = 2
endif
longbreakeven = 1
if strategie=1 then
longbreakevenstart = 40
longbreakevenstep = 15
elsif strategie = 2 then
longbreakevenstart = 20
longbreakevenstep = 5
elsif strategie = 3 then
// etc....
endif
génial ! merci encore Nicolas.