Hmmm played around a bit more my interperation of the range value may of been wrong to calculate TP & SL. Here is updated code without Walk Forward that shows a decent profit.

Quote:

int FridayStopHour = 16;
int SlowVolatilityOffset = 3;

var VF(int Fa, int Sa)
{
var sumF = 0.0, sumS = 0.0;
int i;

for (i = 1; i <= Fa; i++)
sumF += priceClose(i) - priceOpen(i);
for (i = 1; i <= Sa; i++)
sumS += abs(priceClose(i + SlowVolatilityOffset) - priceOpen(i + SlowVolatilityOffset));

return((sumF / Fa) / (sumS / Sa));
}

bool IsTradeTime()
{
if (dow(0) >= 5 && FridayStopHour >= 0 && hour(0) >= FridayStopHour)
return(false);
else
return(true);
}

function run() {
set(TICKS+TESTNOW);
BarPeriod = 15;
LookBack = 100;

int FastVolatilityBase = 5;
int SlowVolatilityBase = 58;
var VolatilityFactor = 2.2;
int ProfitLossVolatilityBase = 46;
var VolFac = VF(FastVolatilityBase, SlowVolatilityBase);
var Range = HH(ProfitLossVolatilityBase) - LL(ProfitLossVolatilityBase);

Stop = 0.16*Range;
TakeProfit = 0.43*Range;

if(IsTradeTime()&& abs(VolFac) > VolatilityFactor) {

if(VolFac > 0.0)
enterLong();
else if(VolFac < 0.0)
enterShort();
}
}


Question still stands in regards to the VolFac & the Range variable now though.