Problemi con la funzione Lowest

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #116477 quote
    Guidoz
    Participant
    New

    Buona sera a tutti.

    Ho problemi con la funzione “Lowest” inserita in questo banale codice… praticamente vorrei che l’acquisto scatti non appena il minimo della barra sia inferiore al minimo registrato nelle 22 barre precedenti. Scritta così non mi esegue alcun acquisto (neppure se sostituisco 22 con 2 che è un arco temporale piccolissimo), se sostituisco “<” con “>” esegue degli acquisti ma il criterio non è comunque corretto. Sapete aiutarmi? Grazie.

    DEFPARAM CumulateOrders = False
    
    IF Low < Lowest [22] (low) THEN
       PrezzoStopLoss = low
       BUY 1 SHARES AT MARKET
    ENDIF
    
    SET STOP $LOSS ABS(tradeprice - PrezzoStopLoss)
    SET TARGET $PROFIT ABS(tradeprice - PrezzoStopLoss)

     

    #116480 quote
    robertogozzi
    Moderator
    Master

    Perché LOW non può essere inferiore a se stesso!

    Tu non stai cercando nelle 22 barre PRECEDENTI, bensì nelle ULTIME 22 barre, da quella corrente alla 21esima precedente.

    Sostituisci la riga 3 con questa in modo da considerare solo le barre precedenti e non quella corrente:

    IF Low < Lowest[22](low[1]) THEN
    #116574 quote
    Guidoz
    Participant
    New

    Grazie Roberto!

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

Problemi con la funzione Lowest


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Guidoz @guidoz Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Guidoz
6 years, 1 month ago.

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