vorrei costruire un trading system basato su pattern di prezzo tipo:
setup= (open<close) and (open[1]>close[1]) and (high<high[1]) and (low>low[1])
entrata= high + POINTSIZE
IF NOT LongOnMarket AND setup THEN
BUY 1 CONTRACTS AT entrata stop
ENDIF
set target pprofit 10
fino a qui tutto bene…..il problema è che non riesco a mette lo stop sotto il livello low[1] del setup.
Ciao, qui di seguito come posizionare lo stop loss a “Low” [1]:
SET STOP LOSS Close-Low[1]
Ditemi se questo funziona? Grazie!
purtroppo no
se ad esempio passano 10 candele dopo l’acquisto, lui mi considera l’ultimo chiusura e l’ultimo low[1].
io vorrei metterlo al low[1] del pattern……e che restasse quello per sempre
ho provato con il barindex…….cioè
numerocandele= barindex-(tradeindex+2) // conto il numero di candele che sono passate dall’acquisto + 2 candele per tornare indietro di due dall’acquisto
stoploss=low[numerocandele]
ma non funziona…….non so prorpio come fare
Ciao, scusa se non capisco la tua richiesta.
E ‘questo codice corrisponde a ciò che si vuole fare?
setup= (open<close) and (open[1]>close[1]) and (high<high[1]) and (low>low[1])
entrata= high + POINTSIZE
IF NOT LongOnMarket AND setup THEN
BUY 1 CONTRACTS AT entrata stop
set target pprofit 10
SET STOP LOSS Close-Low[1]
ENDIF
ti ringrazio Nicolas……pare che funzioni……..lo testerò per bene
nel ProBacktest funziona benissimo……..il problema è nel trading automatico.
Mi rifiuta di fare il trading automatico e mi esce una scritta:
DEFPARAM CumulateOrders = False
defparam FLATBEFORE=090000
defparam flatafter=170000
bwr=(open<close) and (open[1]>close[1]) and (high<high[1]) and (low>low[1])
entrata= high + POINTSIZE
IF NOT LongOnMarket AND bwr THEN
BUY 1 CONTRACTS AT entrata stop
ENDIF
If LongOnMarket AND barindex-tradeindex>=4 THEN
SELL AT MARKET
ENDIF
set stop loss (high-low[1])+3*pointsize
set target profit 8