Impostazione giorni di trading di un TS

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #222119 quote
    tundercuttundercut
    Participant
    Senior

    Ciao a tutti, ho un trading system semplice che gira H24, però vorrei che sabato e domenica rimanga flat e ricominci ad operare lunedì. Qualcuno può aiutarmi ?

    Grazie.

    #222146 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Se è su un timeframe intraday basta che indichi l’orario, del Venerdì. in cui vuoi chiudere tutto (che sia almeno 1 minuto prima della chiusura, altrimenti non può chiudere a mercato già chiuso e la chiusura la fa alla riapertura (che sia di Domenica sera o Lunedì) mattina, con i rischi di gap:

    IF OpenDayOfWeek = 5 AND Time = 235900 THEN //se usi 1 minuto, oppure 225500 se usi 5 minuti, 223000 se usi 30 minuti, ecc...
       SELL      AT MARKET
       EXITSHORT AT MARKET
    ENDIF

    Se usi il Giornaliero, è simile, solo che non va indicato l’orario, però in questo caso, chiudendo alla chiusura del Venerdì sera, l’effettivo ordine varrà eseguito solo alla riapertura dei mercati:

    IF OpenDayOfWeek = 5 THEN
       SELL      AT MARKET
       EXITSHORT AT MARKET
    ENDIF
    #222155 quote
    tundercuttundercut
    Participant
    Senior

    Grazie Roberto come sempre molto gentile, questa è una soluzione, però vorrei che il sistema sia piu preciso per evitare anche l’aumento delle commissioni. Quindi dovrebbe chiudere le posizioni venerdi alle 22,00 e riaprirle alle 2,00 del lunedi.

    #222249 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Eccolo:

    ONCE Riapertura = 0
    IF OpenDayOfWeek = 5 AND Time = 220000 THEN
       IF LongOnMarket THEN
          SELL      AT MARKET
          Riapertura = 1
       ELSIF ShortOnmarket THEN
          EXITSHORT AT MARKET
          Riapertura = -1
       ELSE
          Riapertura = 0
       ENDIF
    ENDIF
    IF OpenDayOfWeek = 1 AND Time = 020000 THEN
       IF Riapertura = 1 THEN
          BUY 1 Contract at Market
       ELSIF Riapertura = -1 THEN
          SELLSHORT 1 Contract at Market
       ENDIF
       Riapertura = 0
    ENDIF
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Impostazione giorni di trading di un TS


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
tundercut @tundercut Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
3 years ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 10/07/2023
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...