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
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.
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
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