Ordinii cumulativi e prezzo medio

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #134621 quote
    volpiemanuele
    Participant
    Veteran
    DEFPARAM CumulateOrders=true
    
    Pipstep=40
    Piputile= 25
    count = 0
    maxcount = 3
    
    Candelalong= ((close-open)*pipsize)
    Candelashort =((open-close)*pipsize)
    
    if Not shortonmarket and candelalong > pipstep and count <= maxcount then
    BUY 1 CONTRACTS AT MARKET
    obiettivo = positionprice + (piputile*pipsize)
    count = count + 1
    endif
    
    if Not longonmarket and Candelashort > pipstep and count <= maxcount then
    SELLSHORT 1 CONTRACTS AT MARKET
    obiettivo1 = positionprice + (piputile*pipsize)
    count = count + 1
    endif
    
    timeframe (5 minutes)
    if longonmarket and  close >= obiettivo then
    SELL AT MARKET
    count = 0
    
    endif
    
    if shortonmarket and close <= obiettivo1 then
    EXITSHORT AT MARKET
    count = 0
    ENDIF
    

    Il seguente sistema dovrebbe funzionare cosi ma non funziona:

    • time frame principale H4;
    • Se la dimensione della candela (chiusura – apertura) è maggiore di pipstep entra;
    • Alla chiusura di ogni candela se avverata la condizione precedente aggiunge una posizione; ovvio che se alla prima entrata raggiunge il TP si inizia da capo;
    • Posizione massime 3 (variabile maxcount)
    • Chiusura della posizione pari al prezzo medio + piputile;
    • Controllo per uscire su time frame 5 minuti.

    Ho provato a modificare il sistema in vari modi ma ci sono diverse cose che non vanno bene. Mi potete aiutare ?

    Grazie

    #134632 quote
    robertogozzi
    Moderator
    Master

    Hai fatto un pò di confusione con PIPSIZE. Alle righe 19 e 13 va bene, perché devi convertire un valore di pips numerico in prezzo, ma alle righe  8 e 9 è l’opposto, devi convertire un prezzo (in questo caso una differenza di prezzo) in pips, quindi devi dividere e non moltiplicare per PIPSIZE.

    Comunque se hai provato sul Dax o simili strumenti con rapporto pip:prezzo di 1:1 non è questo il motivo di malfunzionamento (resta comunque un errore logico da correggere).

    Alla riga 19 occorre il “-“ perché devi sottrarre per trovare l’obiettivo.

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

Ordinii cumulativi e prezzo medio


ProOrder: Trading Automatico & Backtesting

New Reply
Author
Summary

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

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