Errore backtest rotture supporti e resistenze 1 ora

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #90614 quote
    maximus78
    Participant
    Senior

    Buongiorno, stavo provando una strategia e mi sono accorto che probacktest non esegue le entrate in modo corretto.

    Ho semplificato la strategia in modo da capire dove sono gli errori di impostazione.

    Forex, 1 hour chart

    Se il prezzo della 2° (01:00) candela supera il massimo della 1° (00:00) di 1 pip, entra long

    Se il prezzo della 2° candela supera il minimo della 1° (00:00)di 1 pip, entra short.

    Esce automaticamente all’apertura della successiva candela.

    Il problema è che, quando la 2° candela supera entrambi il massimo e minimo precedenti, probacktest entra sia long e short, mentre voglio che entri solo in posizione 1 volta, alla prima rottura che si verifica.

    Il codice esegue perfettamente le entry in sistemi separati long e short, anche intradaybarindex=0 è corretto.

    Allego codice, non riesco a capire dove sbaglio…..

    Grazie in anticipo a tutti per l’aiuto.

    defparam cumulateorders=false
    
    entrylong=highest[1](high)
    entryshort=lowest[1](low)
    
    if not onmarket and intradaybarindex=0 and entrylong then
    buy 1 shares at entrylong +(1*pointsize) stop
    endif
    
    if longonmarket then
    sell at market
    endif
    
    if not onmarket and intradaybarindex=0 and entryshort then
    sellshort 1 shares at entryshort-(1*pointsize) stop
    endif
    
    if shortonmarket then
    exitshort at market
    endif
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Errore backtest rotture supporti e resistenze 1 ora


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
maximus78 @maximus78 Participant
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 02/06/2019
Status: Active
Attachments: No files
Logo Logo
Loading...