ProOrder stop giornaliero dopo target price raggiunto

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #260050 quote
    Marco CesariniMarco Cesarini
    Participant
    New

    Buongiorno ho bisogno di inserire un semplice codice

    stop a sistema di trading automatico della giornata dopo un target price grazie

    Chi mi può aiutare

    #260064 quote
    NicolasNicolas
    Keymaster
    Legend

    Il codice funziona così:

    • All’inizio di ogni nuova giornata (IntradayBarIndex = 0) memorizza il profitto di partenza e azzera il flag TargetReached.
    • Ad ogni barra calcola il profitto fatto oggi (ProfitToday = StrategyProfit – ProfitAtDayStart).
    • Appena il profitto giornaliero raggiunge o supera il DailyTarget, imposta TargetReached = 1.
    • Se TargetReached = 1, il sistema chiude l’eventuale posizione aperta e non entra in nessun nuovo trade per il resto della giornata.
    • Se TargetReached = 0, le tue normali condizioni di entrata sono attive.

    Devi solo:

    1. Impostare DailyTarget con il valore che ti interessa (in punti o valuta, coerente con il tuo strumento).
    2. Sostituire le condizioni di esempio (incrocio della media a 20 barre) con le tue reali condizioni di entrata.
    DEFPARAM CumulateOrders = False
    
    
    // --- Parametri configurabili ---
    DailyTarget = 200  // Target giornaliero in punti/valuta
    
    
    // --- Reset all'inizio di ogni nuova giornata ---
    IF IntradayBarIndex = 0 THEN
        ProfitAtDayStart = StrategyProfit
        TargetReached    = 0
    ENDIF
    
    
    // --- Profitto accumulato oggi ---
    ProfitToday = StrategyProfit - ProfitAtDayStart
    
    
    // --- Attivazione dello stop giornaliero al raggiungimento del target ---
    IF ProfitToday >= DailyTarget THEN
        TargetReached = 1
    ENDIF
    
    
    // ================================================================
    // INSERISCI QUI LE TUE CONDIZIONI DI INGRESSO
    // ================================================================
    IF TargetReached = 0 THEN
    
    
        // Esempio: sostituisci con le tue condizioni reali
        IF close CROSSES OVER average[20](close) THEN
            BUY 1 CONTRACT AT MARKET
        ENDIF
    
    
        IF close CROSSES UNDER average[20](close) THEN
            SELLSHORT 1 CONTRACT AT MARKET
        ENDIF
    
    
    ELSE
        // Target raggiunto: chiudi la posizione aperta, nessun nuovo trade
        IF OnMarket THEN
            SELL AT MARKET
            EXITSHORT AT MARKET
        ENDIF
    ENDIF
    

    Se hai già il tuo sistema di trading e vuoi integrare questo blocco, incollami il codice esistente e lo adatto direttamente!

    robertogozzi thanked this post
    #260080 quote
    Marco CesariniMarco Cesarini
    Participant
    New

    TargetReached = 1

    perfetto grazie mille 😙

Viewing 3 posts - 1 through 3 (of 3 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

ProOrder stop giornaliero dopo target price raggiunto


ProOrder: Trading Automatico & Backtesting

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Marco CesariniMarco Cesarini
5 months, 2 weeks ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 04/10/2026
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...