Backtest Result-Equity Chart not working properly

Posted By: therealLeon

Backtest Result-Equity Chart not working properly - 11/15/16 18:09

Hello,

i wrote a BreakOut Strategie using lhour(CET) to get the right timezone for Germany, Bremen.

The Backtest Result - Chart Window seems not to work properly. The time frame and the day frame is not showing the correct time nor Is the Window showing all dates of the week.

See attachment example (should show 01.09.2016 to 15.09.2016 - but is just showing a few days, not all of them

Does anybody got an idea how to fix this?

Attached picture Backtest Result - Chart Window.png
Posted By: boatman

Re: Backtest Result-Equity Chart not working properly - 11/15/16 23:52

Can you post the script that produced this result? Can't tell much without that.
Posted By: therealLeon

Re: Backtest Result-Equity Chart not working properly - 11/16/16 21:42

This trategy based on a version from swingtraderkk from an older post - i added a few things. Not sure if that ist really the reason for graph failures. How to avoid these Chart Axis failures?
I dont know how to enter code in a window here - sorry to do it directly in the box:

function run()
{

set(LOGFILE+PARAMETERS+FACTORS);

DataSplit = 60;
NumWFOCycles = 10;
Capital = 500;

if(ReTrain)
{
UpdateDays = -1;
SelectWFO = -1;
reset(FACTORS);
}

BarPeriod = 1;
LookBack = 90/BarPeriod;
Hedge = 1;

StartDate = 20100901;


int marketstarthour = 8;
int marketstartminute = 0;
int marketendhour = 17;
int marketendminute = 00;

vars hi = series(priceHigh());
vars lo = series(priceLow());

//Find the high low range of first hours trading
vars enthigh = series(MaxVal(hi,60/BarPeriod));
vars entlow = series(MinVal(lo,60/BarPeriod));

int SetStop = optimize(10,20,60,10);
int SetTrail = optimize(10,20,60,10);

//printf("\n%2.0d:%2.0d High %4.1f Low %4.1f enthigh %4.1f entlow %4.1f",lhour(CET),minute(),hi[0],lo[0],enthigh[0],entlow[0]);

if (NumPendingTotal == 1)
{
for(open_trades)
{
if(TradeIsPending)
exitTrade(ThisTrade);
}
}


if ((lhour(CET) == marketstarthour+1)
and (minute() == marketstartminute))
{

EntryTime = 420/BarPeriod; // Expire pending trades at 16:00

enterLong(0,enthigh[0],SetStop,0,SetTrail);
enterShort(0,entlow[0],SetStop,0,SetTrail);
}


if (((lhour(CET) >= marketendhour)
and (minute() >= marketendminute)) and (NumOpenTotal > 0))
{
printf("\nExiting Open Trades");
exitLong();
exitShort();
}
}
Posted By: boatman

Re: Backtest Result-Equity Chart not working properly - 11/20/16 03:09

When I run this script, I get chart output that covers the entire period. Check your History folder - maybe you don't have enough historical market data to run the entire simulation that you want.

Also, your stop loss values don't make much sense. You are optimizing over a range of 20-60, which would only make sense for some equity indexes, futures or high-priced stocks. Better to set your stop loss taking into consideration the size of a pip. That way, your script is applicable to individual markets, regardless of the price they trade at. For example, instead of Stop = 60, try Stop = 60*PIP.

Hope that helps.
Posted By: therealLeon

Re: Backtest Result-Equity Chart not working properly - 11/21/16 14:57

Hello boatman,

thanks for your response i will take it in account!
© 2024 lite-C Forums