salve, stavo scrivendo questa strategia che in teoria dovrebbe individuare i livelli importanti che si vengono a creare durante la giornata, non sempre fa quello che dico io anche perche io ho suddiviso la giornata in 3 time da prendere in analisi ma in realta le resistenze e supporti possono formarsi in qualsiasi momento, ho anche notato che forse il prt indica automaticamente tali livelli ma non so usarli nella strategie
DEFPARAM FLATAFTER=220000
BegTime=091000
EndTime=215000
MyContracts=1
IF Time = 090000 THEN
maxSetup = highest[100](high[1])
endif
IF not shortonmarket and Time = 120000 THEN
maxSetup = highest[10](high[1])
endif
IF not shortonmarket and Time = 170000 THEN
maxSetup = highest[10](high[1])
endif
//minSetup = lowest[3](low[1])
//sllong = MinSetup - 36*pipsize
slshort = MaxSetup + 60*pipsize//minSetup//maxSetup
tp = maxSetup - 50*pipsize// * 2 //intervallo tra Min e Max * 2
//c1=adx>31
if intradaybarindex=0 then
tradethisday=0
else
if barindex=tradeindex then
tradethisday=1
endif
endif
If (not shortonmarket) and high >maxsetup and close<maxsetup and Time >= BegTime and Time <= EndTime and tradethisday=0 and (dayofweek=1 or dayofweek=2 or dayofweek=3 or dayofweek=4 or dayofweek=5)then
sellshort mycontracts contract at maxSetup limit
endif
if shortonmarket then
exitshort at slshort stop
endif
if shortonmarket then
exitshort at tp limit
endif
set target profit 90
Grazie per averla condivisa.
Quello che c’è sul grafico NON può essere letto in alcun modo da indicatori, strategie e screener, per cui non ci sono alternative a trovarsi da soli resistenze, supporti, e qualunque altra figura o pattern.
secondo te quale potrebbe essere un modo corretto per scrivere il codice per individuare resistenze e supporti?
Questo è un indicatore che può aiutarti.
Puoi inserire il codice nella tua strategia:
DEFPARAM DrawOnLastBarOnly = TRUE
//ONCE Periodi = 100
ONCE HH = 0
ONCE LL = 0
ONCE HHres = 0
ONCE HHsup = 0
//
HH = highest[Periodi](max(open,close))
IF HH <> HH[1] THEN
Conto = 0
FOR i = 1 TO Periodi
IF (high[i] >= HH) AND max(open[i],close[i]) <= HH THEN
Conto = Conto + 1
ENDIF
IF max(open[i],close[i]) > HH THEN
Conto = 0
Break
ENDIF
NEXT
IF Conto > 1 THEN
HHres = HH
ENDIF
ENDIF
IF HHres THEN
DrawSegment(Barindex,HHres,BarIndex - (Periodi - 1),HHres) coloured(0,0,255,255)
ENDIF
//
LL = lowest[Periodi](min(open,close))
IF LL <> LL[1] THEN
Conto = 0
FOR i = 1 TO Periodi
IF (low[i] <= HH) AND min(open[i],close[i]) >= LL THEN
Conto = Conto + 1
ENDIF
IF min(open[i],close[i]) < LL THEN
Conto = 0
Break
ENDIF
NEXT
IF Conto > 1 THEN
LLres = LL
ENDIF
ENDIF
IF LLres THEN
DrawSegment(Barindex,LLres,BarIndex - (Periodi - 1),LLres) coloured(255,0,0,255)
ENDIF
RETURN
thanked this post
Scuaste, come si può inserire questo indicatore in una strategia, che dovrebbe entrare long al superamento della resistenza ed entrate short allo sfondamento del supporto.
Ho provato ad inserirlo però non mi cambia assolutamente niente nella strategia
Grazie
Devi togliere la prima riga, l’ultima riga e le due righe dove c’è DRAWSEGMENT.
La resistenza è HHres ed il supporto LLres.
Quindi fai entrare Long quando incrocia al rialzo la resistenza e Short quando incrocia al ribasso il supporto.