codice stop loss

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #195791 quote
    albespo
    Participant
    New

    Buonasera a tutti,

    sto provando a sviluppare un mio trading system, facendo dei backtest in relazione allo stop loss ho trovato delle differenze nei risultati che non riesco a spiegarmi.

    In particolare, ho provato a inserire alla fine del codice la seguente riga:

    set stop loss AverageTrueRange[14](close)*3

    e ottengo in backtest un determinato risultato.

    Se la medesima riga di codice la inserisco subito dopo la condizione per l’apertura della posizione long o short:

    IF Lcond AND Not LongOnMarket THEN
    BUY 1 CONTRACT AT MARKET
    set stop loss AverageTrueRange[14](close)*3
    endif
    IF Scond AND Not ShortOnMarket THEN
    SELLSHORT 1 CONTRACT AT MARKET
    set stop loss AverageTrueRange[14](close)*3
    ENDIF

    ottengo risultati in backtest notevolmente diversi.

    Come si spiega?

    #195796 quote
    robertogozzi
    Moderator
    Legend

    Perché nel primo caso la riga viene eseguita ad ogni barra, quindi lo SL viene continuamente cambiato, mentre nel secondo caso viene stabilito all’apertura dell’operazione e resta invariato.

    albespo thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

codice stop loss


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
albespo @albespo Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
4 years, 2 months ago.

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