3 registered members (AndrewAMD, alibaba, Quad),
761
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Simple Fat Strategy
#449168
03/06/15 14:18
03/06/15 14:18
|
Joined: Feb 2015
Posts: 652 Milano, Italy
MatPed
OP
User
|
OP
User
Joined: Feb 2015
Posts: 652
Milano, Italy
|
I have tried, but I know, I am not good enough to manually trade, in the continuous battle between logic and emotions, my logic is easily defeated. So I have spent some time looking for a reliable platform to develop automated strategies. There are only few platform on the market that have automated portfolio (multi-asset/multi-rules) strategy focus. Most trading platform are very attractive, nice GUI and nice graphs everywhere but unusable for automated trading. So you can imagine how easily I fall in love with Zorro (Graphics Interface will be welcome anyway). I have been able to achieve results in the first day, that was simple impossible with MT4. Ok, now we have the tool, let's use it! The goal is to create a profitable, robust, open, free, strategy; developed, improved and maintained by Zorro's users. Unfortunately This is not an easy task mainly because Zorro has no tool for cooperative software design, no code versioning support. Even the language support is a limit and script encapsulation can not easily be done. On the other hand is so easy in Zorro that some pain could be accepted Let's start in order to cooperate we need to define: - Set measurable goals
- Define the Traded assets
- The Broker
- Select, Improve, Discard Strategies
- Define a testing methodology
- Melt everything together with a skeleton procedure (the Run Function)
I will clear out all the above points in the following posts. Now I need to stress out the method. Everything can be changed, but I have to stress out that in order to be successful we need to speak the same language i.e. if we present fantastic testing results using different assets, different testing periods and different testing methodology is for sure useful from educational purposes, but not really useful for our goals. To keep it simple with the actual single core Zorro training and testing the initial FAT strategy takes hours... Let's try to be focused the Fat Strategy 1.0 that I will introduce as a common starting point acchieve a CAGR of 100%, but is way far to be tradable even in demo. A long work have to be done... I hope to welcome many users helping me in this projects. DISCLAIMER I do not have nothing to sell o to promote, I do this for passion. My goal is to trade my own strategy live asap. I do not recommend anybody to do same. If You will do it, you will do it at your own risk. I am not good in coding. I am not an expert in trading. I am not a guru in testing. If you wanna improve anything of my job you are more than welcome
|
|
|
Re: Simple Fat Strategy
[Re: MatPed]
#449169
03/06/15 14:18
03/06/15 14:18
|
Joined: Feb 2015
Posts: 652 Milano, Italy
MatPed
OP
User
|
OP
User
Joined: Feb 2015
Posts: 652
Milano, Italy
|
Ok The goals and some assumptions: Testing Z12 with standard parameters (just push the test button) produce the following results: Z12.28: FX PH Max 100 Hedg 5 Wknd 2 Verb 2 Walk-Forward Test: Z12 portfolio 2008..2015
Monte Carlo Analysis... Median AR 98% Profit 8743$ MI 189$ DD 1294$ Capital 2240$ Trades 3040 Win 42% Avg +11.0p Bars 18 AR 101% PF 1.39 SR 1.35 UI 8% R2 0.56 Time 00:05:42 The idea is to perform at least as good as this system with except of AR. I think we should not focus too much on AR because we will use the compounding features as a key aspect as our money management, so in short period we could outperform the net gain of Z12 in short period. Not only, thanks of the complete openness of the Fat Strategy we can peek up different assets in order to achieve a better growth. I have defined 3 assets set: - the full set for z12 comparison and final/live testing
- the mini set for intermediate testing: 2 pairs, one metal and one index. The first version of the FS performs better on this.
- the test set, used only for debugging and code testing, meaningless for evaluating results
The compound flag could be turned on or off from the very beginning and, as you can imagine, this has a huge impact on the results after few months. I have not been able to investigate this, but i suggest to train without compounding. I do not know if the optimizing engine in Zorro deactivates this functionality or not while optimizing automatically. Lets see how the Fat Strategy Build #002 performs NO COMPOUNDING Fat Strategy 002 compiling................. Assets........... Walk-Forward Test: Fat Strategy 002 portfolio 2009..2014 Read Fat Strategy 002.fac Fat Strategy 002_1.par Fat Strategy 002_2.par Fat Strategy 002_3.par Fat Strategy 002_4.par Fat Strategy 002_5.par Monte Carlo Analysis... Median AR 110% Profit 29051$ MI 1180$ DD 9594$ Capital 14355$ Trades 3551 Win 51% Avg +226.2p Bars 611 AR 99% PF 1.81 SR 0.83 UI 35% R2 0.25 Generate Chart - please wait... ok COMPOUNDING Fat Strategy 002 compiling................. Assets........... Walk-Forward Test: Fat Strategy 002 portfolio 2009..2014 Read Fat Strategy 002.fac Fat Strategy 002_1.par Fat Strategy 002_2.par Fat Strategy 002_3.par Fat Strategy 002_4.par Fat Strategy 002_5.par Monte Carlo Analysis... Median AR 161% Profit 15828$ MI 643$ DD 2060$ Capital 3512$ Trades 768 Win 55% Avg +134.9p Bars 1066 CAGR 1558% PF 4.18 SR 1.03 UI 20% R2 0.00 As you can imagine from the stats the equity curve is horrible! But now think that i have used only the TS presented in the zorro's manual and in the zorro's video and you can see that we should improve this quite easily... What I like of the FS at this stage - It works
- it's a ready to use skeleton to work on and cooperate
What I do not like- Coding design have to be inproved this will be my first goal beacuse it is the workbench for the future development. A good implementation will speed up the rest of the work.
FAT STRATEGY build 0002 // Build 0002
//#define ASSETLOOP "EUR/USD","GBP/USD","USD/CAD","AUD/USD","USD/JPY", "XAU/USD", "XAG/USD","NAS100","SPX500","GER30","US30","UK100"//FOREX SET
#define ASSETLOOP "EUR/USD","USD/JPY","XAU/USD","SPX500"//MIN FOREX SET
//#define ASSETLOOP "EUR/USD" //test asset
#define CMP 0 // 0: Activate compound. Any non zero value no compound. Not sure if required, bur always train with non zero, trade as you like
// equity curve trading: switch to phantom mode when the equity // curve goes down and is below its own lowpass filtered value function checkEquity() { if(Train) { Lots = 1; return; } // no phantom trades in training mode vars EquityCurve = series(ProfitClosed+ProfitOpen); vars EquityLP = series(LowPass(EquityCurve,10)); if(EquityLP[0] < LowPass(EquityLP,100) && falling(EquityLP)) Lots = -1; // drawdown -> phantom trading else Lots = 1; // profitable -> normal trading }
function enterFSLong() { if(CMP == 0) { Margin = OptimalFLong * Capital * sqrt(1 + max(0,(WinLong-LossLong))/Capital)/100; enterLong(); } else enterLong(); }
function enterFSShort() { if(CMP == 0) { Margin = OptimalFShort * Capital * sqrt(1 + max(0,(WinShort-LossShort)/Capital))/100; enterLong(); } else enterLong(); }
function CLSTR() { TimeFrame=24; Stop = 2*ATR(14); Trail = Stop; TrailLock = 10; checkEquity();
var dayL = optimize(40,10,80); var dayS = optimize(40,10,80); if (priceHigh() >= HH(dayL)) enterFSLong(); if (priceLow() <= LL(dayS)) enterFSShort(); }
function CNTR() { TimeFrame = 4; Trail = 0; vars Price = series(price()); vars Filtered = series(BandPass(Price,optimize(30,20,40),0.5)); vars Signal = series(Fisher(Filtered,500)); var Threshold = optimize(1,0.5,1.5,0.1); checkEquity(); if(crossUnder(Signal,-Threshold)) enterFSLong(); else if(crossOver(Signal,Threshold)) enterFSShort(); }
function TRND() { TimeFrame = 1; Stop = optimize(4,2,8) * ATR(100); Trail = 0; var compound = CMP; vars Price = series(price()); vars Trend = series(LowPass(Price,optimize(500,300,800))); checkEquity(); if(valley(Trend)) enterFSLong(); else if(peak(Trend)) enterFSShort(); }
function run() { set(PARAMETERS+FACTORS); // generate and use optimized parameters and factors
BarPeriod = 60; // 1 hour bars LookBack = 10000; // needed for Fisher() NumWFOCycles = 6; // activate WFO StartDate = 2009; EndDate = 2014; Hedge=5; if(CMP==0) Capital=5000; if(ReTrain) { UpdateDays = -1; // update price data from the server SelectWFO = -1; // select the last cycle for re-optimization reset(FACTORS); // don't generate factors when re-training } NumWFOCycles = 6; // activate WFO
// portfolio loop while(asset(loop(ASSETLOOP))) while(algo(loop("TRND","CNTR","CLSTR"))) { if(Algo == "TRND") TRND(); if(Algo == "CNTR") CNTR(); if(Algo == "CLSTR") CLSTR(); }
PlotWidth = 700; PlotHeight1 = 400; //ColorUp = ColorDn = ColorWin = ColorLoss = 0; // don't plot candles and trades //set(TESTNOW+PLOTNOW); }
A long way to go...
Last edited by MatPed; 03/08/15 16:46.
|
|
|
Re: Simple Fat Strategy
[Re: royal]
#449209
03/08/15 13:57
03/08/15 13:57
|
Joined: Feb 2015
Posts: 652 Milano, Italy
MatPed
OP
User
|
OP
User
Joined: Feb 2015
Posts: 652
Milano, Italy
|
Welcome Royal, we have a tons of work to do. The first version of the strategy in on post #449169.
Ciao
Last edited by MatPed; 03/08/15 15:00.
|
|
|
|