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.
Doubt to run backtest using signal
Doubt to run backtest using signal
- 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
- 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
Hint #1: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.
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.
- 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
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.
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.
Re: Doubt to run backtest using signal
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.
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.