come evitare ingressi dopo uno stop loss

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #72502 quote
    Luigi Iervolino
    Participant
    New

    Buonasera a tutti sono nuovo del forum, e stò provando a programmare le prime strategie per il trading automatico, ho una domanda da neofito

    come posso fare per evitare nuovi ingressi dopo uno stop loss, vi è la possibilità di mettere in attesa il sistema ad esempio per 5 candele o 20 min. prima di aprire nuove posizioni.

    ringrazio anticipatamente qualche anima pia che voglia illuminarmi

    #72511 quote
    robertogozzi
    Moderator
    Master

    Questo esempio evita di rientrare fino al giorno successivo (quando IntraDayBarIndex=0 riparte)

    ONCE Tradare   = 1
    ONCE Profitto  = 0
    IF IntraDayBarIndex = 0 THEN
       Profitto  = StrategyProfit
       Tradare = 1
    ENDIF
    IF StrategyProfit < Profitto THEN
       Tradare = 0
    ENDIF
    IF MieCondizioni AND Tradare THEN
       BUY ..........
    ENDIF
    #72570 quote
    Luigi Iervolino
    Participant
    New

    Grazie della risposta,

    ok per l’intraday ma se vorrei fare una cosa analoga dopo n. barre

    esempio

    dopo stop loss metti in pausa per le successive tre barre e dopo riprendi l’operatività.

    #72573 quote
    robertogozzi
    Moderator
    Master

    Devi innanzitutto stabilire in quale barra è avvenuto lo Stop Loss, per farlo verifichi di non essere OnMarket attualmente, ma di esserlo stato nella barra precedente OnMarket[1], questo indica che avevi una posizione aperta.

    ONCE Tradare   = 1
    ONCE Profitto  = 0
    ONCE MiaBarra  = 0
    IF IntraDayBarIndex = 0 OR (BarIndex - MiaBarra) >= 10 THEN
       Profitto = StrategyProfit
       MiaBarra = 0
       Tradare  = 1
    ENDIF
    IF StrategyProfit < Profitto THEN
       Tradare  = 0
    ENDIF
    IF Not OnMarket AND OnMarket[1] THEN
       MiaBarra = BarIndex
    ENDIF
    IF MieCondizioni AND Tradare THEN
       BUY ..........
    ENDIF

    In questo esempio ho messo 10 barre, ovviamente tu metti quello che vuoi. Non ho fatto alcun test, provalo e fammi sapere.

    #72582 quote
    Luigi Iervolino
    Participant
    New

    Salve ho provato a fare qualche test non ho ben capito il parametro di conteggio delle barre come funziona, forse bisogna indicare il time frame, mettendo 10 non ho risultati ma sembrerebbe che conta una barra ogni 10.000 infatti inserendo 30.000 pare mi conteggi tre barre a 5min.

    #72604 quote
    robertogozzi
    Moderator
    Master

    L’ho aggiustata un pò e l’ho testata sul DAX, h1. Mi sembra vada bene, dopo uno Stop Loss si ferma per 10 barre, in ogni caso riprate il giorno successivo anche se non sono trascorse 10 barre.

    DEFPARAM CumulateOrders = false
    
    ONCE Tradare   = 1
    ONCE Profitto  = 0
    ONCE MiaBarra  = 0
    
    IF IntraDayBarIndex = 0 OR (MiaBarra AND ((BarIndex - MiaBarra) >= 10)) THEN
       Profitto = StrategyProfit
       MiaBarra = 0
       Tradare  = 1
    ENDIF
    IF StrategyProfit < Profitto THEN
       Tradare  = 0
    ELSE
       Profitto = StrategyProfit
    ENDIF
    IF Not OnMarket AND OnMarket[1] THEN
       MiaBarra = BarIndex
    ENDIF
    IF close CROSSES OVER average[20](close) AND Tradare AND not OnMarket THEN
       BUY 1 CONTRACT AT MARKET
       SET STOP   pLOSS   40
       SET TARGET pPROFIT 40
    ENDIF

    Ovviamente è una strategia d’esempio basata sul prezzo che incrocia al rialzo una media semplice a 20 periodi. Non ho fatto caso alla performance ed allo spread.

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

come evitare ingressi dopo uno stop loss


ProOrder: Trading Automatico & Backtesting

New Reply
Author
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by robertogozzi
7 years, 8 months ago.

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