Ciao, volevo condividere questo sistema nato per “caso”, dopo averlo scritto e testato i risultati erano talmente pessimi che girando Long e Short sono diventati ottimi!
Il sistema si basa su timeframe a 1 minuto, tende ad essere un pochino pericoloso perchè lo SL è molto alto, però il backtest è incoraggiante.
Purtoppo è molto legato al trend, e non ho trovato un modo per capire in automatico il trend ed impostarlo automaticamente, servirebbe una media dei giorni precedenti, ma non ho capito come fare, aspetterò IG con l’aggiornamento alla v.11.
La configurazione è semplice, nel sistema bisogna indicare l’asset sul quale si vuole lavorare (io ne ho configurati alcuni, tra cui uno generico) e la direzione. Nell’indicatore ci sono le configurazioni per il N di contratti, e lo SL, che vengono poi ripassati al sistema.
Per ora i mercati sono al rialzo, ma ho provato mettendo -1 quindi Short su USD/ZAR che è al ribasso e sembrerebbe dare comunque buoni risultati. Purtoppo con IG a 1 minuto il periodo di backtest è molto breve.
Mi piacerebbe migliorarlo se vi viene in mente qualcosa sarei ben felice di implementarlo.
if Open>Close then
Candela=-1
else
Candela=1
endif
MMEP=EndPointAverage[48](close)
//ParDirezione=1
//ParAsset=1
//GENERIC=0
//USRUSSELL=1
//EURUSD=2
//DAX=3
//US500=4
if ParAsset=0 then
//GENERIC
ParSL=100
ValContratti=1
endif
if ParAsset=1 then
//USRUSSELL
ParSL=100
ValContratti=0.5
endif
if ParAsset=2 then
//EURUSD
ParSL=100
ValContratti=2
endif
if ParAsset=3 then
//DAX
ParSL=200
ValContratti=0.5
endif
if ParAsset=4 then
//US500
ParSL=100
ValContratti=1
endif
StatoPosizione=0
ValDirezione=ParDirezione //1=Long, -1=Short
ValSL=ParSL*pipsize
if Minute=0 or Minute=5 or Minute=10 or Minute=15 or Minute=20 or Minute=25 or Minute=30 or Minute=35 or Minute=40 or Minute=45 or Minute=50 or Minute=55 then
If ValDirezione=1 then //Lomg
l1=Close[1] < MMEP[1] and Candela[1]=-1
l2=Close[1] > Close[intradaybarindex+540]
l3=time>100000 and time <143000 or time>163000 and time <193000
l4=Close > Close[120]
if PositionLong=0 and PositionShort=0 and l1 and l2 and l3 and l4 then
PrezzoApertura=close[1]
PrezzoStopLoss=close[1]-ValSL
PrezzoTakeProfit=highest[2](high)
if PrezzoTakeProfit > PrezzoApertura then
if DayOfWeek=5 and time>150000 then
else
PositionLong=1
StatoPosizione=2
endif
endif
endif
if PositionLong[1]=1 and Close<PrezzoStopLoss or PositionLong[1]=1 and Close>PrezzoTakeProfit then
if Close>PrezzoApertura then
DRAWARROWUP(barindex,StatoPosizione-0.3)Coloured(0,255,0)
else
DRAWARROWUP(barindex,StatoPosizione-0.3)Coloured(255,0,0)
endif
PositionLong=0
StatoPosizione=1
endif
endif
If ValDirezione=-1 then //Short
s1=Close[1] < MMEP[1] and Candela[1]=1
s2=Close[1] < Close[intradaybarindex+540]
s3=time>100000 and time <143000 or time>163000 and time <193000
s4=Close < Close[120]
if PositionShort=0 and PositionLong=0 and s1 and s2 and s3 and s4 then
PrezzoApertura=close[1]
PrezzoStopLoss=close[1]+ValSL
PrezzoTakeProfit=lowest[2](low)
if PrezzoTakeProfit < PrezzoApertura then
if DayOfWeek=5 and time>150000 then
else
PositionShort=1
StatoPosizione=-2
endif
endif
endif
if PositionShort[1]=1 and Close>PrezzoStopLoss or PositionShort[1]=1 and Close<PrezzoTakeProfit then
if Close<PrezzoApertura then
DRAWARROWDOWN(barindex,StatoPosizione+0.3)Coloured(0,255,0)
else
DRAWARROWDOWN(barindex,StatoPosizione+0.3)Coloured(255,0,0)
endif
PositionShort=0
StatoPosizione=-1
endif
endif
endif
Return StatoPosizione COLOURED(255,0,0) as "StatoPosizione",ValContratti as "ValContratti"
// Condizioni per entrare su posizioni long
//GENERIC=0
//USRUSSELL=1
//EURUSD=2
//DAX=3
//US500=4
StatoPosizione,ValContratti=call TrendScalping[1,3] //[Direzione 1=LONG:-1=SHORT,Asset]
IF NOT LongOnMarket AND StatoPosizione=2 THEN
BUY ValContratti CONTRACTS AT MARKET
ENDIF
// Condizioni per uscire da posizioni long
If LongOnMarket AND StatoPosizione=1 THEN
SELL AT MARKET
ENDIF
// Condizioni per entrare su posizioni short
IF NOT ShortOnMarket AND StatoPosizione=-2 THEN
SELLSHORT ValContratti CONTRACTS AT MARKET
ENDIF
// Condizioni per uscire da posizioni short
IF ShortOnMarket AND StatoPosizione=-1 THEN
EXITSHORT AT MARKET
ENDIF
// Stop e target: Inserisci qui i tuoi stop di protezione e profit target