Range daily

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #47311 quote
    R05
    Participant
    Veteran

    Buonasera vorrei testare un codice calcoli il valore medio tra massimo e minimo del giorno e che mi entra in posizione al giorno successivo al breakout dello stesso.

    Per meglio chiarirmi:

    1. massimo del 22 settembre 12648,4
    2. minimo del 22 settembre 12552
    3. valore medio: (12648,4+12552)/2= 12600,2
    4. il 23 settembre mi deve entrare long o short (a seconda se è prima long o short) al breakout di questo valore

    Vi allego il codice che ho provato a fare, ma non ffunziona.

    Mi aiutereste?

    defparam cumulateorders = false
    
    a=dhigh(1)+dlow(1)/2
    
    // Condizioni per entrare su posizioni long
    buy 1 contract at a stop
    
    // Condizioni per entrare su posizioni short
    sellshort 1 contract at a stop
    
    
    set stop ploss 40
    set target pprofit 20
    
    #47317 quote
    robertogozzi
    Moderator
    Master

    Hai scritto la formula, correttamente, valore medio: (12648,4+12552)/2= 12600,2 mettendo le parentesi dove devono andare; nel codice, invece, non le hai messe. Dovrebbe essere così:

    a=(dhigh(1)+dlow(1))/2

    altrimenti divide per 2 solo DLOW(1) e poi lo somma a DHIGH(1).

    #47412 quote
    R05
    Participant
    Veteran

    Ok grazie Roberto, gentilissimo. Ho modificato il codice e ora funziona. Ho aggiunto anche la condizione di fare un solo trade al giorno.

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

Range daily


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
R05 @r05 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by R05
8 years, 4 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 09/25/2017
Status: Active
Attachments: No files
Logo Logo
Loading...