Multi time frame senza updateonclose

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #207627 quote
    robysolda
    Participant
    New

    Buongiorno, avrei bisogno di aiuto per creare un codice in multitime frame.

    Uso tf a 3 minuti e tf default 5 secondi.  Voglio che la mia condizione di ingresso ( che lavora al tf 3 min. senza il comando updateonclose)  sia presa solo una volta nella medesima candela.

    Mi potete aiutare? Grazie

    Roberta

    #207641 quote
    robertogozzi
    Moderator
    Master

    Eccolo (l’ho provato sul DAX, 5 secondi):

    DEFPARAM CumulateOrders = False
    //
    Timeframe(3mn,default)
    c1 = close > average[100,0](close)
    //
    Timeframe(default)
    ONCE OK = 1
    IF (OpenMinute <> OpenMinute[1]) AND (OpenMinute MOD 3 = 0) THEN
       OK = 1
    ENDIF
    IF c1 AND Ok = 1 AND Not OnMarket THEN
       BUY at Market
       OK = 0
    ENDIF
    SET STOP   pLOSS   10
    SET TARGET pPROFIT 10
    graph Ok

    ho usato la variabile OK per stabilire quando è possibile entrare a mercato (se OK=1), oppure no. Appena entrato a mercato setta la variabile a 0, per cui non può più entrare. La setta nuovamente ad 1 quando cambia minuto ed è un minuto divisibile per 3.

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

Multi time frame senza updateonclose


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
robysolda @robysolda Participant
Summary

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

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