// General parameter
DEFPARAM CumulateOrders = False
// number of contracts, here in countervalue
// Domain of n [5 – 25] step 5
pdiffperc = ((close/close[n])-1)*100
// ENTERING CONDITIONS
//level, to be optimized domain 0.6 – 3 step 0.3, alpha moltiplicator is for distorsion in long / short positions
level2 = -a*level
c1 = (pdiffperc <= level2)
c3 = (pdiffperc >= level)
IF not onmarket and c1 THEN
BUY 7500 cash AT MARKET
elsif not onmarket and c3 then
SELLSHORT 7500 cash AT MARKET
ENDIF
// profit e loss are expressed in optimization as intere numbers
pr1 = pr/100
lo1 = lo/100
// trailing inversion indicator, tr1 is the trigger,
longtr = (low – high[1])/high[1]*100
c5 = (longtr < -tr1)
shorttr = (high – low[1])/low[1]*100
c6 = (shorttr > tr1)
// b is digital function
b = b
c7 = (b >0)
IF longonmarket and positionperf >= pr1 THEN
SELL AT MARKET
elsif longonmarket and positionperf <= lo1 then
sell at market
elsif longonmarket and c5 and c7 then
sell at market
elsif shortonmarket and positionperf >= pr1 then
exitshort at market
elsif shortonmarket and positionperf <= lo1 then
exitshort at market
elsif shortonmarket and c6 and c7 then
exitshort at market
ENDIF
Tif file on Google sites
- Adattabile (è “universale”)
- Può essere unico in un sistema di portafoglio di strategie senza eccessivo incremento del rischio
- Fornisce risultati utili senza eccessivi sforzi: pertanto si può implementare un’utile diversificazione di un portafoglio di trading automatizzato utilizzando diversi strumenti finanziari (non è così scontato se devo implementare un TS “classico” perché per es. non ne trovo uno utile per le materie prime).
- testato su 20 strumenti su Prorealtime, ha sempre battuto i risultati di TS classici con performance di un 20-30% superiori e drawdown incrementati di un 15-20%. Non solo in backtest, ma ora anche in tempo reale