Walk Forward Analysis Equity Curve

Posted By: antoniorenar

Walk Forward Analysis Equity Curve - 03/22/21 01:04

Hello,

In the 2 last lines of the code below I've tried to plot the walk forward analysis equity curve. Nevertheless, when I press the "Train" button I only obtain the parameter graphs. And if I then press the "result" button, I still don't get the walk forward equity curve. May anyone help me to solve the problem, please?

#include <profile.c>

function run()
{
set(LOGFILE);
set(PARAMETERS);

StartDate=2018;
NumYears=1;

BarPeriod = 1440;

//FOR WALK FORWARD ANALYSIS:
NumWFOCycles = 3;
DataSplit = 20;

//PARAMETERS TO BE OPTIMIZED:
int stoploss = optimize(30,10,50,10);
int stopprofit = optimize(60,20,80,10);

//ENTRIES:
if( NumOpenLong==0 and priceClose(0)>priceClose(1) ) enterLong();
if( NumOpenShort==0 and priceClose(0)<priceClose(1) ) enterShort();

//EXITS:
Stop = stoploss*PIP;
TakeProfit = stopprofit*PIP;

//PLOT EQUITY CURVE (WALK FORWARD):
set(PLOTNOW);
plotWFOCycle(Equity,0);
}
Posted By: ferboes

Re: Walk Forward Analysis Equity Curve - 03/24/21 23:16

I have the same problem. frown
Posted By: Neb

Re: Walk Forward Analysis Equity Curve - 03/25/21 19:50

Hi,

As manual said, I think after training, you should go to test, with this parameters (which are already saved in Data folder.)
And then you should get equity curve.
Not before.

Neb
Posted By: antoniorenar

Re: Walk Forward Analysis Equity Curve - 03/25/21 20:05

I know there is a folder in which Zorro save the daily data in a csv file, but I do not know how to use this file in order to plot the walk forward equity curve. May you help me with an example, please?
Posted By: Neb

Re: Walk Forward Analysis Equity Curve - 03/27/21 21:31

I think you made a couple of mistakes probably.
First, you need to make series from priceClose().

vars Closes = series(priceClose());


if( NumOpenLong==0 and Closes[0]>Closes[1]) enterLong();
if( NumOpenShort==0 and Closes[0]<Closes[1]) enterShort();


I also commented line:

//plotWFOCycle(Equity,0);

And then, did traing and test and after that Zorro plotted me equity line.

Maybe it helps ?

Neb

Posted By: antoniorenar

Re: Walk Forward Analysis Equity Curve - 03/29/21 23:16

Hi Neb,

First of all, I apologize for my delay in replying, as I have been busy. Following your instructions, I have programmed this:

#include <profile.c>

function run()
{
set(LOGFILE);
set(PARAMETERS);

StartDate=2018;
NumYears=1;

BarPeriod = 1440;

//FOR WALK FORWARD ANALYSIS:
NumWFOCycles = 3;
DataSplit = 20;

//PARAMETERS TO BE OPTIMIZED:
int stoploss = optimize(30,10,50,10);
int stopprofit = optimize(60,20,80,10);

vars Closes = series(priceClose());

//ENTRIES:
if( NumOpenLong==0 and Closes[0]>Closes[1] ) enterLong();
if( NumOpenShort==0 and Closes[0]<Closes[1] ) enterShort();

//EXITS:
Stop = stoploss*PIP;
TakeProfit = stopprofit*PIP;

//PLOT EQUITY CURVE (WALK FORWARD):
set(PLOTNOW);
}

When I press the Train button and then Test I obtain an equity curve, but... are you sure it is the walk forward equity curve and not another equity curve with the same parameters in all the periods? How can we know it, Neb?


By the way, it is not necessary to use:

vars Closes = series(priceClose());
if( NumOpenLong==0 and Closes[0]>Closes[1]) enterLong();
if( NumOpenShort==0 and Closes[0]<Closes[1]) enterShort();

This is correct, but it also do the same as:

if( NumOpenLong==0 and priceClose(0)>priceClose(1) ) enterLong();
if( NumOpenShort==0 and priceClose(0)<priceClose(1) ) enterShort();


Thank you very much for your help, Neb!
© 2024 lite-C Forums