I'm still in the learning phase but attempting to design / write a trading strategy for Gold using multiple algo's.

This below algo is causing me problems - it does not open any Long trades, and i think it should. I am not sure why this is??

The TimeFrame is a strange one but seems to work on backtest.

Any views as to the possible cause would be greatly appreciated.

Thanks..

Quote:
function Algo4() // Support/Resistance...
{

TimeFrame = 16;

Stop = 3.10*ATR(8);
Trail = 1.55*ATR(6);
//TrailStep = 3.43; // optimize(5,2,7) * ATR(47);
//TrailSlope = 5;
TakeProfit = 2.98*ATR(18);

vars Price = series(price());
var High = dayHigh(UTC,1);
var Low = dayLow(UTC,1);
var Pivot = dayPivot(UTC,1);
var *SM = series(SMA(Price,210));
var *SM1 = series(RSI(Price,7));
int Max = 1; // Max Trades

var S1 = 2*Pivot - High;
var S2 = Pivot - (High - Low);
var S3 = 2*Pivot - (2*High - Low);
var R1 = 2*Pivot - Low;
var R2 = Pivot + (High - Low);
var R3 = 2*Pivot + (High - 2*Low);

{
if (Price >= SM && NumOpenLong <1 && rising(SM1))

Entry =(R3-50*PIP);
reverseLong(Max);

if (Price <= SM && NumOpenShort <1 && falling(SM1))

Entry = (S3-50*PIP);
reverseShort(Max);

}
}

function run()
{
BarPeriod = 240;
set(PARAMETERS+FACTORS);
LookBack = 3500;
//StartDate 20120101;
//EndDate = 20130101;
//set(LOGFILE);
//Margin = 75;
set(MUTE);
//Capital = 1000;
//Margin = OptimalF * Capital * sqrt(5 + (WinTotal-LossTotal)/Capital);
// Lots = 1;
//Detrend = 8; // inverse curve
//NumWFOCycles = 5;
//DataSplit = 70;
//Hedge = 2;
{
while(asset(loop("XAU/USD")))

//while(algo(loop("Algo1","Algo2","Algo3")))
while(algo(loop("Algo4")))

// if(Algo == "Algo1")
//
// Algo1();
//
// else if (Algo == "Algo2")
//
// Algo2();
//
// else if (Algo == "Algo3")
//
// Algo3();

if (Algo == "Algo4")

Algo4();
}

PlotWidth = 800;
set(PLOTNOW);
}


Quote:

Percent winning 48%
Max win/loss 62$ / -42$
Avg trade profit 4.13$ 565.6p (+24$ / -14$)
Avg trade slippage -0.06$ -7.8p (+0.04$ / -0.16$)
Avg trade bars 26 (+34 / -18)
Max trade bars 108 (26 days)
Time in market 80%
Max open trades 2
Max loss streak 6 (uncorrelated 7)

Annual return 136%
Profit factor 1.57 (PRR 1.11)
Sharpe ratio 1.21
Kelly criterion 1.09
Ulcer index 14.1%
Prediction error 65%

Portfolio analysis OptF ProF Win/Loss Wgt%

Algo4 avg .013 1.57 33/36 100.0

XAU/USD:Algo4 .027 1.57 33/36 100.0
XAU/USD:Algo4:L .000 ---- 0/0 0.0
XAU/USD:Algo4:S .027 1.57 33/36 100.0


Last edited by Geek; 11/27/13 21:42.