My Zorro Adventure

The stop computation did not sit well with me so I changed it to a simple 14 bar ATR with a multiple.


//Three Little Pigs and its variants. 
//Liftoff (R)

function run()
{
	set(PARAMETERS);
	BarPeriod = 240; // 4 Hour bars
	StartDate = 2009;
//	EndDate =  2012;
	LookBack = 2880;
	Hedge = 0;
	
	//First Pig
	vars Price = series(price());
	vars SMAW = series(SMA(Price,1650)); // Weekly Trend (SMA 55)
	
	//Second Pig
	vars SMAD = series(SMA(Price,126));  // Daily Trend (SMA 21)
	
	//Third Duck
	vars SMA4H = series(SMA(Price,34));  // 4 Hour Trend (SMA 34)
	
	Stop = ATR(14)*optimize(1,1,6,1);
	Trail = ATR(14)*optimize(1,1,6,1);
	
	
	if(Price[0]>SMAW[0] && Price[0]>SMAD[0] && Price[0]>SMA4H[0]){
		enterLong();
	} 
	else if(Price[0]<SMAW[0] && Price[0]<SMAD[0] && Price[0]<SMA4H[0]){
		enterShort();
	}
}

Gold and Silver


BackTest: ThreelittlePigs XAU/USD 2009..2014
Read ThreelittlePigs_XAUUSD.par
Profit 5517$  MI 179$  DD 12892$  Capital 14374$
Trades 1741  Win 35%  Avg +417.0p  Bars 60
AR 15%  PF 1.20  SR 0.21  UI 96.6%  Error 20%

ThreelittlePigs run..
BackTest: ThreelittlePigs XAG/USD 2009..2014
Read ThreelittlePigs_XAGUSD.par
Profit 30367$  MI 1200$  DD 12531$  Capital 16140$
Trades 1461  Win 46%  Avg +54.7p  Bars 134
AR 94%  PF 1.89  SR 0.57  UI 63.1%  Error 15%

Some impressive numbers on the these two commodities.

USoil


ThreelittlePigs run..
BackTest: ThreelittlePigs USOil 2009..2014
Read ThreelittlePigs_USOil.par
Profit -8903$  MI -254$  DD 49457$  Capital 63734$
Trades 2097  Win 32%  Avg -5.6p  Bars 23
AR -6%  PF 0.95  SR -0.10  UI 121.4%  Error 20%

Yen


ThreelittlePigs run..
BackTest: ThreelittlePigs USD/JPY 2009..2014
Read ThreelittlePigs_USDJPY.par
Profit 3386$  MI 91$  DD 4827$  Capital 5834$
Trades 2115  Win 26%  Avg +21.1p  Bars 98
AR 22%  PF 1.27  SR 0.21  UI 67.6%  Error 24%
Generate Chart - please wait... ok

USDCHF


ThreelittlePigs run..
BackTest: ThreelittlePigs USD/CHF 2009..2014
Read ThreelittlePigs_USDCHF.par
Profit 556$  MI 15$  DD 5136$  Capital 5548$
Trades 2337  Win 31%  Avg +2.9p  Bars 45
AR 3%  PF 1.05  SR 0.06  UI 60.4%  Error 20%

USDCAD


ThreelittlePigs run..
BackTest: ThreelittlePigs USD/CAD 2009..2014
Read ThreelittlePigs_USDCAD.par
Profit -4156$  MI -111$  DD 4596$  Capital 5062$
Trades 2124  Win 26%  Avg -26.7p  Bars 46
AR -29%  PF 0.50  SR -0.78  UI 0.0%  Error 24%

NZDUSD


ThreelittlePigs run..
BackTest: ThreelittlePigs NZD/USD 2009..2014
Read ThreelittlePigs_NZDUSD.par
Profit -2396$  MI -64$  DD 3325$  Capital 3677$
Trades 2141  Win 27%  Avg -14.7p  Bars 29
AR -23%  PF 0.71  SR -0.50  UI 262.0%  Error 23%

GBPUSD


BackTest: ThreelittlePigs GBP/USD 2009..2014
Read ThreelittlePigs_GBPUSD.par
Profit -3091$  MI -83$  DD 4848$  Capital 5412$
Trades 2130  Win 29%  Avg -19.1p  Bars 31
AR -20%  PF 0.70  SR -0.44  UI 0.0%  Error 22%

EURUSD


ThreelittlePigs run..
BackTest: ThreelittlePigs EUR/USD 2009..2014
Read ThreelittlePigs_EURUSD.par
Profit -4159$  MI -111$  DD 9814$  Capital 10788$
Trades 2168  Win 28%  Avg -25.2p  Bars 93
AR -14%  PF 0.79  SR -0.20  UI 233.9%  Error 22%

AUDUSD

ThreelittlePigs run..
BackTest: ThreelittlePigs AUD/USD 2009..2014
Read ThreelittlePigs_AUDUSD.par
Profit -3886$  MI -104$  DD 10130$  Capital 10818$
Trades 2383  Win 30%  Avg -21.5p  Bars 87
AR -12%  PF 0.77  SR -0.18  UI 568.6%  Error 21%

Hi,

Yea, great improvements really. But there will still be a lot of ulking :wink:

Try adding martingale mix in it with lower base start lot.

Looks workable… A little more tinkering can lead to a worth while system. Any ideas?

Using a martingale money management?

So four candles on the three little pigs thread made some changes to the base system mainly by introducing a fixed stop loss of 30 pips and a target of 60 pips. I decided to incorporate this into the system and test it out and compare with his results.

//Three Little Pigs and its variants. 
//Liftoff (R)

function run()
{
	set(PARAMETERS);
	BarPeriod = 240; // 4 Hour bars
	StartDate = 2009;
//	EndDate =  2012;
	LookBack = 2880;
	Hedge = 0;
	
	//Asset Portfolio
   while(asset(loop("EUR/USD","USD/CHF","AUD/USD","GBP/USD","NZD/USD","USD/CAD","USD/JPY"))){
 			//First Pig
	vars Price = series(price());
	vars SMAW = series(SMA(Price,1650)); // Weekly Trend (SMA 55)
	
	//Second Pig
	vars SMAD = series(SMA(Price,126));  // Daily Trend (SMA 21)
	
	//Third Duck
	vars SMA4H = series(SMA(Price,34));  // 4 Hour Trend (SMA 34)
	
	Stop = 30*PIP;
	TakeProfit = 60*PIP;
		
	
	if(Price[0]>SMAW[0] && Price[0]>SMAD[0] && Price[0]>SMA4H[0]){
		enterLong();
	} 
	else if(Price[0]<SMAW[0] && Price[0]<SMAD[0] && Price[0]<SMA4H[0]){
		enterShort();
	}  	
}
}

My results produce a loss but his testing produced profits. Funny how I seem to automate these systems and the supposed profits all vanish. I will take my time to check his entries against mine later.

ThreelittlePigs compiling............... assets......
BackTest: ThreelittlePigs portfolio 2009..2014
Profit -2738$  MI -73$  DD 3207$  Capital 3615$
Trades 14690  Win 33%  Avg -2.5p  Bars 5
AR -27%  PF 0.89  SR -1.11  UI 523.4%  Error 13%
Generate Chart - please wait... ok

Yes. Normally what i do is to calculate the recent losses and have the lot size determined by a fixed/variable “Recovery distance”. This recovery distance is usually the avg profit distance. Any extra of this distance will generate profit + past losses recovery.

I do have positive experiences with this on trend based system. But do tread carefully with martingale as they are not very forgiving in most systems.

I have read only bad things about martingale based money management and position sizing systems. I will do some reading and see if the research and data support the assessions the masses make. Will definitely look into incorporating your suggestion and see.

Not sure if you’ve programmed it, but Huck also closes her trades when an EMA crossover occurs in the opposite direction. It’s not strictly closed based on trailing stops.

IE:

From her New System for 2012: Trend-Catcher 3.0 page:

  1. Long at 1.2956, closed at 1.2928 (-28 pips) when a new crossover materialized.
  2. Short at 1.2928, closed at 1.2937 (-9 pips) when a new crossover materialized.
  3. Long at 1.2937, closed at 1.3027 (+90 pips) when a new crossover materialized.

The Amazing Crossover Strategy also mentions to always move your S/L after you are in profit so that you break even.

I ll implement those changes and see how things change