Salve, come posso interrompere una strategia per esempio al verificarsi di 3 trade perdenti consecutivi?
Grazie mille.
Once Conto = 0
If IntraDayBarIndex = 0 then
Conto = 0
Endif
If STRATEGYPROFIT < STRATEGYPROFIT[1] then
Conto = Conto + 1
Elsif STRATEGYPROFIT > STRATEGYPROFIT[1] and Conto < 3 then
Conto = 0
Endif
If MieCondizioni and Not OnMarket and Conto < 3 then
Buy 1 Contract at market
Endif
Un trade è perdente quando STRATEGYPROFIT > STRATEGYPROFIT[1], cioè quando nella candela attuale la strategia risulta < alla candela precedente.
Basta incrementare un contatore ed azzerarlo se, prima che arrivi a 3 ce n’è una in profitto.
Il conteggio lo userai come condizione aggiuntiva per entrare, o meno, a mercato.
Nel mio esempio ho messo che ogni inizio giorno il conto si azzera.
Grazie molte, ma ci sarebbe modo proprio di stoppare il trading automatico, in modo che possa arrivare la notifica via mail dello stop?
Tra la riga 6 e la 7 metti queste tre righe:
IF Conto = 3 THEN
Quit
ENDIF