Spegnimento TS durante le Feste

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #174257 quote
    Wolf Trades
    Participant
    Average

    Buonasera, sto provando a scrivere delle righe di codice che producano come effetto lo “spegnere” il mio TS durante le festività che ricorrono sempre lo stesso giorno dell’anno, in più vorrei fermare il mio TS durante le feste natalizie (dal 24 Dicembre al 6 Gennaio)

    Putroppo non funziona, per questo chiedo aiuto a voi:

    // ***Elenco Festività in cui non si opera***//
    Capodanno = CurrentMonth = 1 and Day = 1
    PrimoMaggio = CurrentMonth = 5 and Day = 1
    UNITATEDESCA = CurrentMonth = 10 and Day = 3
    VIGILIA = CurrentMonth = 12 and Day = 24
    NATALE = CurrentMonth = 12 and Day = 25
    UltimoAnno = CurrentMonth = 12 and Day = 31
    
    FesteNatalizie = (CurrentMonth = 12 and (Day = 26 or Day = 27 or Day = 28 or Day = 29 or Day = 30)) or (CurrentMonth = 1 and (Day = 2 or Day = 3 or Day = 4 or Day = 5))
    Feste= Day[0] = Capodanno or Day[0] = PrimoMaggio or Day[0] = UNITATEDESCA or Day[0] = VIGILIA or Day[0] = NATALE or Day[0] = UltimoAnno or Day[0] = FesteNatalizie
    Calendario = Not Feste
    #174263 quote
    robertogozzi
    Moderator
    Master

    Prova a sostituire CurrentMonth con OpenMonth e Day  con OpenDay.

    #174266 quote
    Wolf Trades
    Participant
    Average

    Grazie Roberto ma purtroppo non funziona

    #174268 quote
    robertogozzi
    Moderator
    Master

    Ti spiace postare l’esempio che hai scritto?

    #174269 quote
    Wolf Trades
    Participant
    Average
    // ***Elenco Festività in cui non si opera***//
    Capodanno = OpenMonth = 1 and OpenDay = 1
    PrimoMaggio = OpenMonth = 5 and OpenDay = 1
    UNITATEDESCA = OpenMonth = 10 and OpenDay = 3
    VIGILIA = OpenMonth = 12 and OpenDay = 24
    NATALE = OpenMonth = 12 and OpenDay = 25
    UltimoAnno = OpenMonth = 12 and OpenDay = 31
    
    FesteNatalizie = (OpenMonth = 12 and (OpenDay = 26 or OpenDay = 27 or OpenDay = 28 or OpenDay = 29 or OpenDay = 30)) or (OpenMonth = 1 and (OpenDay = 2 or OpenDay = 3 or OpenDay = 4 or OpenDay = 5))
    Feste= OpenDay[0] = Capodanno or OpenDay[0] = PrimoMaggio or OpenDay[0] = UNITATEDESCA or OpenDay[0] = VIGILIA or OpenDay[0] = NATALE or OpenDay[0] = UltimoAnno or OpenDay[0] = FesteNatalizie
    Calendario = Not Feste
    //******************************************************************************************************//
    // ***Finestra Temporale in cui si opera*** //
    Finestra= currenttime >= 000000 and currenttime <= 230000
    //******************************************//
    
    MassimodiIeri = DHigh(1) + (15*pipsize)
    
    Venerdi = OpenDayofWeek = 5
    
    
    // Condizioni per entrare su posizioni long
    IF NOT LongOnMarket AND Close > MassimodiIeri and Finestra and Calendario and not Venerdi THEN
    BUY 1 CONTRACTS AT MARKET
    SET STOP pLOSS 3000
    SET TARGET pPROFIT 3000
    ENDIF
    
    // Condizioni per uscire da posizioni long
    If LongOnMarket AND opendayofweek=5 and currenttime > 205900 THEN
    SELL AT MARKET
    ENDIF
    #174284 quote

    Ti mando questo che ogni tanto uso.

    // NON OPERARE NEL MESE E GIORNI
    IF not (Month = 12 AND (Day = 29  OR Day = 30 OR Day = 31 OR Day)) THEN
    
    Questo è solo un esempio....metti i mesi e i giorni che vuoi.
    Ciao
    
    
    
    #174286 quote

    Ops….. scusa ma non so cosa è successo.

    // NON OPERARE NEL MESE E GIORNI
    IF not (Month = 12 AND (Day = 27 OR Day = 28 OR Day = 29 OR Day = 30 OR Day = 31)) THEN

    Ecco fatto, metti i mesi e i giorni che vuoi.

    #174287 quote
    // NON OPERARE NEL MESE E GIORNI
    IF not (Month = 12 AND ( Day = 25 OR Day = 26 OR Day = 27 OR Day = 28 OR Day = 29 OR Day = 30 OR  Day = 31)) THEN

    Insert PRT Code non va con il browser di Firefox.

    Così è più capibile con crome.

    Ciao

    #174289 quote
    robertogozzi
    Moderator
    Master

    Modifica la riga 10 così:

    Feste          = Capodanno or PrimoMaggio or UNITATEDESCA or VIGILIA or NATALE or  UltimoAnno or FesteNatalizie

    Non usare le doppie assegnazioni (comuni ad altri linguaggi più sofisticati e di uso generale). In questo caso sono anche superflue.

    #174326 quote
    lunaoutrun
    Participant
    New

    Salve,
    direttamente dal manuale:

    IF (Month = 5 AND Day = 1) OR (Month = 12 AND (Day = 24 OR Day = 25 OR Day = 26 OR Day = 30 OR Day = 31)) THEN
    GiornoTrading = 0
    ELSE
    GiornoTrading = 1
    ENDIF

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

Spegnimento TS durante le Feste


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Wolf Trades @lupo32 Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 07/27/2021
Status: Active
Attachments: No files
Logo Logo
Loading...