Riportiamo il listato di un trading system che appartiene ai miei studi giovanili (2002) e pubblicato nell’area riservata del mio sito nel 2008 (ne trovate una variante diversa nella newsletter n. 2) . Il trading system è basato sui punti di Pivot calcolati su data2 daily con data 1 che può essere usato a 30 o 60 minuti. Il buypoint è data da (H+L+C)/3 cui si somma l’ATR a 5 periodi. Il Sellshort point è dato (H+L+C)/3 meno ATR a 5 periodi.
Usiamo due filtri: il time delle operazioni deve essere compreso tra la prima candela giornaliera e le 16 del pomeriggio. Inoltre l’ADX deve essere maggiore di 25.
La gestione della posizione è affidata ad un target di metà posizione (utilizziamo almeno due contratti). Il livello è calcolato col prezzo d’ingresso cui sommiamo (caso long) o sottraiamo (caso short) il truerange di data2. Lo stop loss è del 2% non ottimizzato. E’ presente inoltre un trailing stop calcolato su massimi e minimi di data2.
Trasferendo materiale dal vecchio al nuovo sito pareva brutto mettere test oramai obsoleti, pertanto ho provato il trading system dal 2014 ad oggi (ognuno aggiunga commissioni e slippage).
Come potete vedere, con un profit factor > 1,5 i risultati non sarebbero stati disprezzabili pur in assenza di ottimizzazioni un minimo necessarie almeno per aggiustare i livelli di stop.
{**************************-Pivot-Intraday-***********************
Utilizza la nota tecnica dei pivot points per stabilire livelli di entrata intraday su supporti e resistenze, con data2 daily
Programmatore: Enrico Malverti
Anno: 2002
Copyright www.enricomalverti.com 2008
******************************************************************}
Vars: EP(0), MP(0), PivPnt(0), Resistance1(0), Support1(0), NumCont(0);
Input: AdxVal(25), StL(3), StS(3);
If T = Sess1FirstBarTime Then Begin
Value1 = (H data2);
Value2 = (L data2);
Value3 = (C data2);
PivPnt = (Value1 + Value2 + Value3)/3;
Resistance1 = (PivPnt) +avgtruerange(5);
Support1 = (PivPnt) – avgtruerange(5);
End;
MP = MarketPosition;
EP = EntryPrice;
If T > Sess1FirstBarTime and Adx(14) > AdxVal and MP = 0 and T <= 1600 Then Begin
If CloseD(0) < OpenD(0) Then Sellshort (“PVT-S”) next bar at Support1 +1 Point Stop;
If CloseD(0) > OpenD(0) Then Buy (“PVT-L”) next bar at Resistance1 -1 Point Stop;
End;
{*****************************-Multiexit-1-**************************}
If MP = 1 Then sell (“1TLP”) currentcontracts/2 share next bar at (EP + (Range of data2)) Limit;
If MP = -1 Then buytocover (“1TSP”) currentcontracts/2 share next bar at (EP – (Range of data2)) Limit;
{****************************-Trailing stop-**************************}
If MP = 1 Then sell (“TRL”) next bar at (Lowest(L, 2)[1]) of data2 Stop;
If MP = -1 Then buytocover (“TRS”) next bar at (Highest(H, 2)[1]) of data2 Stop;
{**************************-Stop loss-***************************}
If MP = 1 Then ExitLong (“SLL”) next bar at (EP – EP * StL / 100) Stop;
If MP = -1 Then ExitShort (“SLS”) next bar at (EP + EP * StS / 100) Stop;
setexitonclose;
DISCLAIMER: il presente materiale ha esclusivamente scopo didattico. Il trading con denaro reale comporta il rischio di perdite. I risultati di tecniche applicate al passato non sono garanzia di pari rendimenti futuri. L’autore non è responsanile di eventuali perdite derivanti dall’utilizzo dei codici presentati.
Strategy Performance Summary | |||
All Trades | Long Trades | Short Trades | |
Net Profit | 52022,04675 | 32682,1485 | 19339,89825 |
Gross Profit | 132666,56425 | 87959,3095 | 44707,25475 |
Gross Loss | -80644,5175 | -55277,161 | -25367,3565 |
Adjusted Net Profit | 30181,5836811282 | 16101,5545098501 | 3848,6240158796 |
Adjusted Gross Profit | 120752,755079512 | 79119,0662748411 | 35765,8038 |
Adjusted Gross Loss | -90571,1713983839 | -63017,511764991 | -31917,1797841204 |
Select Net Profit | 23856,71175 | 24869,84725 | -1013,1355 |
Select Gross Profit | 71348,88675 | 61585,41075 | 9763,476 |
Select Gross Loss | -47492,175 | -36715,5635 | -10776,6115 |
Account Size Required | 11059,9485 | 12651,767 | 7037,5425 |
Return on Account | 470,3642765606 | 258,3208219057 | 274,810393685 |
Return on Initial Capital | 52,02204675 | 32,6821485 | 19,33989825 |
Max Strategy Drawdown | -12886,6855 | -13793,325 | -9743,13325 |
Max Strategy Drawdown (%) | -10,7729136393 | -11,7937026053 | -9,0500625163 |
Max Close To Close Drawdown | -11059,9485 | -12651,767 | -7037,5425 |
Max Close To Close Drawdown (%) | -9,3478861835 | -10,8753843331 | -6,6579665978 |
Return on Max Strategy Drawdown | 4,036883398 | 2,3694177075 | 1,9849772916 |
Profit Factor | 1,6450785294 | 1,5912414442 | 1,7623931272 |
Adjusted Profit Factor | 1,3332360973 | 1,2555092078 | 1,1205815815 |
Select Profit Factor | 1,5023293153 | 1,6773652609 | -0,9059875639 |
Max # Contracts Held | 2 | 2 | 2 |
Slippage Paid | 0 | 0 | 0 |
Commission Paid | 0 | 0 | 0 |
Open Position P/L | n/a | n/a | n/a |
Annual Rate of Return | 51,6332950419 | 32,4379204881 | 19,1953745538 |
Monthly Rate of Return | 4,3027745868 | 2,7031600407 | 1,5996145462 |
Buy & Hold Return | -8816,2143820288 | -8816,2143820288 | -1090,5941676316 |
Avg Monthly Return | 4001,6959038462 | ||
Monthly Return StdDev | 6235,5833427248 | ||
Performance Ratios | |||
Upside Potential Ratio | n/a | ||
Sharpe Ratio | 0,644611975 | ||
Sortino Ratio | 1,5130987446 | ||
Fouse Ratio | 0,0324892725 | ||
Calmar Ratio | 0,009794818 | ||
Sterling Ratio | 0,001977353 | ||
Net Profit as % of Largest loss | 781,1191433854 | ||
Net Profit as % of Max Trade Drawdown | 781,1191433854 | ||
Net Profit as % of Max Strategy Drawdown | 403,6883397985 | ||
Select Net Profit as % of Largest loss | 358,2122467365 | ||
Select Net Profit as % of Max Trade Drawdown | 358,2122467365 | ||
Select Net Profit as % of Max Strategy Drawdown | 185,1268252802 | ||
Adj Net Profit as % of Largest loss | 453,1811849755 | ||
Adj Net Profit as % of Max Trade Drawdown | 453,1811849755 | ||
Adj Net Profit as % of Max Strategy Drawdown | 234,2074979724 |
Complimenti alla generosità dell’autore che non ha remore di pubblicare un suo intero trading system che, seppur didattico, presenta già una sua completezza e rende bene l’idea di applicazione di una strategia. Grazie E. Malverti !
Grazie, fa piacere che ci sia chi apprezza lo sforzo divulgativo.
em