Doubt to run backtest using signal

Questions about MultiCharts and user contributed studies.
strelow

Doubt to run backtest using signal

Postby strelow » 01 May 2014

Hello guys . I´m new here but already study MC for a log time.

Im trying to run backtest .

First I used this code that Works :

Inputs: R(8);
Var: Swing(0);

Value1=Average(H,R);
Value2=Average(L,R);

If C<Value2[1] And C[1]>=Value2[2] then Swing=-1;
If C>Value1[1] And C[1]<=Value1[2] then Swing=1;

If Swing=1 Then Begin
buy this bar on close;
end;
If Swing=-1 Then Begin
sellshort this bar on close;
end;


Then I did some modification and typed this code :


Inputs:
Bulli_Estrategia_Status_Number(Indicator:"Bulli_Estrategia_Long_Relacao_Gain_Lost_Rev11" plot21);
Var: Status(0);

Status = Bulli_Estrategia_Status_Number;

If Status=1 Then Begin
buy("BuyConf+") this bar on close;
end;
If Status=9 Then Begin
sell("Out") this bar on close;
end;


When I run backtest and look to the reports no data appears .

Do you know why ? Before simulate I changed max number of bar study to 100 because I received erro message that 50 is not enough.
Attachments
backtest_com_resposta.jpg
file first code working
(204.73 KiB) Downloaded 433 times
backtest_sem_resposta.jpg
file test no data
(176.79 KiB) Downloaded 439 times

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Doubt to run backtest using signal

Postby TJ » 01 May 2014

Hello guys . I´m new here but already study MC for a log time.
Im trying to run backtest .
First I used this code that Works :
Inputs: R(8);
Var: Swing(0);
Value1=Average(H,R);
Value2=Average(L,R);
If C<Value2[1] And C[1]>=Value2[2] then Swing=-1;
If C>Value1[1] And C[1]<=Value1[2] then Swing=1;
If Swing=1 Then Begin
buy this bar on close;
end;
If Swing=-1 Then Begin
sellshort this bar on close;
end;
Then I did some modification and typed this code :
Inputs:
Bulli_Estrategia_Status_Number(Indicator:"Bulli_Estrategia_Long_Relacao_Gain_Lost_Rev11" plot21);
Var: Status(0);
Status = Bulli_Estrategia_Status_Number;
If Status=1 Then Begin
buy("BuyConf+") this bar on close;
end;
If Status=9 Then Begin
sell("Out") this bar on close;
end;
When I run backtest and look to the reports no data appears .
Do you know why ? Before simulate I changed max number of bar study to 100 because I received erro message that 50 is not enough.
Hint #1:

Do not use generic variable names and condition names (ie value1, value2, condition1, etc.,)
You should create a meaningful name for each variable, so that you can read and easily understand your logic. Half the battle in debugging is in understanding your code.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Doubt to run backtest using signal

Postby TJ » 01 May 2014

ps.
[FAQ] How to Post Codes (that people can read)
viewtopic.php?f=16&t=11713

strelow

Re: Doubt to run backtest using signal

Postby strelow » 01 May 2014

Ok. Thanks

But even this first code not so good is working . Second code I changed variable to decide buy or sell using indicator declared inside signal and not working anymore . Could you list some possible causes that why backtester not give any report .

Ploting graf using this second code I can see arrow indicating buy and sell but trying to use in backtester no data result.

wegi
Posts: 124
Joined: 02 Jun 2009
Has thanked: 5 times
Been thanked: 13 times

Re: Doubt to run backtest using signal

Postby wegi » 02 May 2014

hi,


not sure what your problem is exactly i did some testing.
Based on your code in post 1, i made an indicator and a signal using the indicator as input.
And this worked, also in backtest.

For detailed help, i think we need the code.


Return to “MultiCharts”