Gestione Posizione

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12662 quote
    Conte CaimanoConte Caimano
    Participant
    Master

    Ciao a tutti

    Il TS Swing Point Long l’ho testato sul DAX con tutti i dati a disposizione (dall’inizio fino all’ultima data), però la gestione della posizione da marzo 2002 a dicembre 2006 sembra non funzionare bene, c’è qualcuno che può indicarmi come migliorarla/correggerla ?

    DEFPARAM CumulateOrders = False
    // ---------------------------------------------------------------------
    // Swing points long
    // ---------------------------------------------------------------------
    // --- calcola Lotti
    Once Lotti = 1
    // ---------------------------------------------------------------------
    // Swing points long type 1
    c1 = (close>close[1] and close[1]<close[2])
    c2 = (close[2]>close[3] and close[3]<close[4])
    c3 = (close>close[2] and close[1]>close[3])
    
    EntryLongType1 = c1 AND c2 AND c3
    
    // Swing points long type 2
    c4=(close>close[1] and close[1]<close[2])
    c5=(close[2]>close[3] and close[3]<close[4])
    c6=(close>close[2] and close[1]<close[3])
    
    EntryLongType2 = c4 AND c5 AND c6
    // ---------------------------------------------------------------------
    // --- Strategia
    Long = EntryLongType1 OR EntryLongType2
    // ---------------------------------------------------------------------
    // Condizioni per entrare su posizioni long
    IF NOT LongOnMarket AND Long THEN
    BUY Lotti CONTRACTS AT MARKET NEXTBAROPEN
    ENDIF
    
    // ---------------------------------------------------------------------
    // Stop e target:
    //trailing stop function
    trailingstart = 20 //trailing stop iniziale
    trailingstep = 5 //passo per spostare lo "stoploss"
    
    //reset StopLoss
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    //gestione posizione Long
    IF LONGONMARKET THEN
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
    
    IF newSL>0 THEN
    SELL AT newSL STOP
    ENDIF
    // ---------------------------------------------------------------------
    Cattura.jpg Cattura.jpg
    #12673 quote
    NicolasNicolas
    Keymaster
    Legend

    A quanto pare, la tua posizione lunga non ha stoploss e TakeProfit, quindi a meno che il trailing stop sia attivato, la tua posizione non sarà mai uscita. Ed è quello che succede nel tuo esempio.

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

Gestione Posizione


ProOrder: Trading Automatico & Backtesting

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by NicolasNicolas
10 years ago.

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