COME IMPEDIRE L’ESECUZIONE DI UN ORDINE

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #167318 quote
    eclarari1
    Participant
    Average

    Buongiorno avrei bisogno di un piccolo supporto di programmazione. Ho impostato l’esecuzione di un ordine in un determinato giorno ad es. DAY=1 (banalmente IF DAY=1 then BUY ….) . Pero’ vorrei che una volta eseguito e chiuso  un ordine nel giorno 1 (sia in profitto che in perdita) non me ne venissero eseguiti altri nello stesso giorno . Come potrei fare? con quali istruzioni?

    Grazie

    Emanuele

    #167321 quote
    robertogozzi
    Moderator
    Master

    Aggiungi questa riga tra le righe iniziali:

    OTD = Barindex - TradeIndex(1) > IntradayBarIndex     // limits the (opening) trades till  1 per day (OTD One Trade per Day)

    e aggiungi OTD tra le condizioni per entrare a mercato.

    eclarari1 thanked this post
    #187691 quote
    eclarari1
    Participant
    Average

    Buona sera, avrei cortesemente bisogno di un aiuto.

    Vorrei che dopo 2 trade negativi  verificatisi in una stessa settimana  (dal Lunedi al Venerdi incluso) il programma non eseguisse piu’ ordini , ma solo alla ripresa della settimana successiva

    Ringrazio anticipatamente

    Cordiali Saluti

    Emanuele

    #187776 quote
    robertogozzi
    Moderator
    Master

    L’ho provato sul DAX, h1 e mi pare funzioni correttamente:

    DEFPARAM CumulateOrders = False
    ONCE Perdite   = 0
    IF DayOfWeek = 1 AND DayOfWeek <> DayOfWeek[1] THEN
       Perdite = 0
    ENDIF
    IF StrategyProfit < StrategyProfit[1] THEN
       Perdite = Perdite + 1
    ENDIF
    OTD             = Barindex - TradeIndex(1) > IntradayBarIndex
    L1              = close CROSSES OVER  Average[20,0](close)
    S1              = close CROSSES UNDER Average[20,0](close)
    CondizioniLong  = L1 AND OTD AND Not LongOnMarket AND Perdite < 2
    CondizioniShort = S1 AND OTD AND Not ShortOnMarket AND Perdite < 2
    IF CondizioniLong  THEN
       BUY 1 Contract at Market
    ENDIF
    IF CondizioniShort THEN
       SELLSHORT 1 Contract at Market
    ENDIF
    SET STOP   pLOSS   50
    SET TARGET pPROFIT 500
    //graph Perdite
    //graph StrategyProfit
    eclarari1 thanked this post
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

COME IMPEDIRE L’ESECUZIONE DI UN ORDINE


ProOrder: Trading Automático y Backtesting

New Reply
Author
author-avatar
eclarari1 @eclarari1 Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automático y Backtesting
Language: Spanish
Started: 04/17/2021
Status: Active
Attachments: No files
Logo Logo
Loading...