robom1
Forumer storico
Io l'ho fatto cosi (vedi in fondo nelle note) ma ad esempio il segno del buy l'ho modificato dopo vedi te.
Codice:
{******************************************************************************
* ERACLE
******************************************************************************}
Var:YestHigh,YestLow,Stretch,Mult,EntryLongLevel,EntryShortLevel;
Mult=35;
YestHigh= Eod.h[1];
YestLow = Eod.l[1];
Stretch=(YestHigh-YestLow)* Mult /100;
if isfirstbarday then
EntryLongLevel = O + Stretch;
EntryShortLevel = O - Stretch;
endif;
if t < 1715 then
if C > entrylonglevel then enterlong(nextbar, atopen); endif;
if C < entryshortlevel then entershort(nextbar,atopen); endif;
endif;
if t>=1715 then
if positiondir = 1 then
exitlong(nextbar,atopen);
endif;
if positiondir=-1 then
exitshort(nextbar,atopen);
endif;
endif;
Plotchart(EntryLongLevel, 0,fuchsia,solid,1);
Plotchart(EntryShortLevel, 0,red ,solid,1);
//se operativo e funzionanente si puo' mettere market if touched
//sul tipo enterlong(nextbar, entrylonglevel, stop) oppure entershort
//in backtest non lo so qual'è la sequenza
//Il livello non è dinamico con le quotazioni ma prende esclusivamente
//il valore di open della prima barra
//de definire stop loss stop profit ecc.ecc.