Durata del set up di 3 candele

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #232952 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    Vorrei aggiungere ad una strategia di break out di un livello di un box una durata definita. Esempio rottura del massimo/minimo del box 8-10 entro le successive 3 candele m15. Grazie

    #232959 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Eccolo:

    DEFPARAM CumulateOrders = False
    ONCE N  = 10
    RangeHH = highest[N](high)
    RangeLL = lowest[N](low)
    IF Not OnMarket THEN
       IF close CROSSES OVER RangeHH[1] THEN
          BUY 1 Contract at MARKET
       ELSIF close CROSSES UNDER RangeLL[1] THEN
          SELLSHORT 1 Contract at MARKET
       ENDIF
    ENDIF
    SET STOP   pLOSS   100
    SET TARGET pPROFIT 200
    graphonprice RangeHH[1] coloured("Blue")
    graphonprice RangeLL[1] coloured("Blue")

    in realtà non c’è un limite temporale, in quanto prende sempre le ultime 10 candele, quindi si modifica spesso, quindi basta verificare se in una certa cndela ha rotto il BOX della candela precedente.

    Gabriele Battista thanked this post
    #254012 quote
    Gabriele BattistaGabriele Battista
    Participant
    Senior

    Ciao, ritorno su questo, senza aprirne uno nuovo. Non credo di essermi spiegato. Lo faccio con un esempio. Il massimo e il minimo del box 8-10 sono 24100 e 23900. Vorrei entrare long a 24101 e short a 23899 ma solo se il break avviene nelle 3 candele successive alla chiusura del box, ossia 10:15, 10:30, 10:45. Grazie

    #254015 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Scusa, avevo male interpretato la tua richiesta. Eccolo il codice corretto:

    DEFPARAM CumulateOrders = False
    ONCE HH    = 0
    ONCE LL    = 0
    ONCE Barre = 0
    IF OpenTime >= 080000 AND OpenTime <= 100000 THEN
       IF OpenTime = 080000 THEN
          HH    = high
          LL    = low
       ENDIF
       HH = max(HH,high)
       LL = min(LL,low)
    ENDIF
    IF Barre > 0 AND Not OnMarket THEN
       IF close CROSSES OVER HH THEN
          BUY 1 Contract at MARKET
       ELSIF close CROSSES UNDER LL THEN
          SELLSHORT 1 Contract at MARKET
       ENDIF
    ENDIF
    IF OpenTime = 100000 THEN
       Barre = 4
    ENDIF
    Barre = Barre - 1
    SET STOP   pLOSS   100
    SET TARGET pPROFIT 200
    //graphonprice HH coloured("Blue")
    //graphonprice LL coloured("Blue")
    //Graph OpenTime >= 080000 AND OpenTime <= 100000
    Iván González thanked this post
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

Durata del set up di 3 candele


ProOrder: Trading Automatico & Backtesting

New Reply
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 05/23/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...