Discussing How to Use Backtesting? article

All posts which do not fit into any other sections of the forum.

Moderator: admin

Re: Discussing How to Use Backtesting? article

Postby boss_hogg » Thu Apr 18, 2013 3:13 pm

Hi Alexey,

I'm also using the MA_advisor strategy on Indicore SDK 2.1 and TS 01.12.031913; I followed your suggestions and triple checked that all parameters matched on all 3 tools:
- TSII strategy backtester
- Indicore >tools->Optimize
- Indicore >tools->check performance/backtest

In Lua runtime I have chosen 'Classic Lua VM'

I used EUR/AUD and got the same results on the 2 Indicore tools (obviously for the 'check performance/backtest' I'm only comparing one result for specific parameters) but different to TSII results. The results remain different nomatter if in Indicore I choose Empty history or Quotes manager. I have attached 2 projects, the TSII backtester and Indicore Optimizer.

Btw, why choose 'Empty history' on SDK?
Attachments
Desktop.zip
(4.68 KiB) Downloaded 628 times
boss_hogg
FXCodeBase: Confirmed User
 
Posts: 48
Joined: Fri Oct 26, 2012 3:03 am

Re: Discussing How to Use Backtesting? article

Postby Alexey.Pechurin » Tue Apr 23, 2013 12:53 am

Hi boss_hogg,

Your Indicore project uses EUR/AUD stream with H1 timeframe. See Choose Price Source dialog settings for First Instrument Price Source. It means that backtesting is based on H1 timeframe. For each bar of this source there are 8 "ticks". In this case you get 8 ticks per hour. You can see it on the Streams page. It's fast but not too precise backtesting.

TS Backtester/Optimizer currently always uses m1 timeframe for backtesting. In this case there are 8 "ticks" per minute.

This is the cause of your difference.

Btw, why choose 'Empty history' on SDK?


It means that when a strategy for example in Prepare tries to execute getHistory command it will receive an empty history. Actually TS Backtester currently does the same - it doesn't return any quotes out of the simulated range.
Alexey.Pechurin
 
Posts: 98
Joined: Sun Jul 22, 2012 11:26 pm

Re: Discussing How to Use Backtesting? article

Postby crazymonkey » Thu Jun 06, 2013 1:19 pm

Hi Guys, Question:

I assume there's no way to include a trade spread calculated into the backtesting optimization?

I guess the only way to try to compensate for the spread is to include a minimum LIMIT level (i.e 3 pips) when using the strategy optimizer to filter out false profit trades less than the spread cost.

:?:

Thanks in advance!
User avatar
crazymonkey
 
Posts: 18
Joined: Tue Apr 02, 2013 5:10 pm

Re: Discussing How to Use Backtesting? article

Postby Valeria » Fri Jun 07, 2013 4:56 am

Hi crazymonkey,

I assume there's no way to include a trade spread calculated into the backtesting optimization?


Could you please clarify your question?
Valeria
 

Re: Discussing How to Use Backtesting? article

Postby boss_hogg » Mon Jun 10, 2013 6:23 am

I tried to set 1m (instead of H1) timeframe on the "Choose Price Source" dialog on Indicore , but when running, the Get History dialog still requests an H1 timeframe, so the results are the same as before.

And in any case, the strategy considers only the closing price of 1H candles for entering or exiting; why does the number of simulated ticks per candle make any difference? :roll: :roll: :roll:


Alexey.Pechurin wrote:Hi boss_hogg,

Your Indicore project uses EUR/AUD stream with H1 timeframe. See Choose Price Source dialog settings for First Instrument Price Source. It means that backtesting is based on H1 timeframe. For each bar of this source there are 8 "ticks". In this case you get 8 ticks per hour. You can see it on the Streams page. It's fast but not too precise backtesting.

TS Backtester/Optimizer currently always uses m1 timeframe for backtesting. In this case there are 8 "ticks" per minute.

This is the cause of your difference.
boss_hogg
FXCodeBase: Confirmed User
 
Posts: 48
Joined: Fri Oct 26, 2012 3:03 am

Re: Discussing How to Use Backtesting? article

Postby Alexey.Pechurin » Wed Jun 12, 2013 7:33 am

Hi boss_hogg,

I tried again your project. To get exactly the same results as in TS Backtestrer you have to specify manually Account Currency in Indicore Backtester. I guess you imply EUR.

I tried to set 1m (instead of H1) timeframe on the "Choose Price Source" dialog on Indicore , but when running, the Get History dialog still requests an H1 timeframe, so the results are the same as before.


Backtester itself uses streams with timeframe specified in Choose Price Source dialog. It affects a number of ticks simulated. Your strategy asks a history of H1 timeframe and Get History dialog demonstrates this history requests. So these are different things.

And in any case, the strategy considers only the closing price of 1H candles for entering or exiting; why does the number of simulated ticks per candle make any difference? :roll: :roll: :roll:


If you try to backtest your strategy on H1 and m1 (in Choose Price Source dialog) you will get slightly different statistics. It's caused by using Stop/Limits by the strategy. When backtesting on H1 Stop/Limits are executed at H1 boundary, when backtesting on m1 they can be executed inside an hour. If you disable using Stop/Limits by the strategy - results will be the same.

Alex
Alexey.Pechurin
 
Posts: 98
Joined: Sun Jul 22, 2012 11:26 pm

Re: Discussing How to Use Backtesting? article

Postby boss_hogg » Thu Jun 13, 2013 6:23 am

That's it! I got exactly the same results, here is a recap for whoever is interested:

In Lua Strategy Debugger backtester:
- In "Chose Price Source" dialog, chose timeframe 1m (because TSII strategy backtester does the same)
- in Account Currency, specify the currency explicitly eg EUR
- All other simulation parameters must be the same as in TS backtester (eg hedging, MMR, lot size,etc)
- When running the simulation, in the "Get History" dialog, chose Empty History

Following the above, I get exactly the same results in both TSII strategy backtester and Lua Strategy Debugger backtester or Oprimizer.

Thank you all for your help :)
boss_hogg
FXCodeBase: Confirmed User
 
Posts: 48
Joined: Fri Oct 26, 2012 3:03 am

Re: Discussing How to Use Backtesting? article

Postby TakisGen » Fri Jun 21, 2013 6:55 am

I do not believe what you have done to the strategy optimizer.
I used to backtest 20 pairs in a range of 4 years with the previous version, without any problem!
Now, after the update, i cannot backtest more than 7 months for 7 instruments.
So, i tried the help files where i found about the sdk optimizer.
I thought things would be better there, but are worst as i was prompted for first, second and third price source.
Is there something i do not understand with my 136 iq?
One, cannot figure out the correct parameters when he has to combine the output of more than two backtests in complex strategies.
Just to give you an idea of what i am talking about:
--local I={"EUR/USD, USD/JPY, GBP/USD, USD/CHF, EUR/CHF, AUD/USD, USD/CAD, NZD/USD, EUR/GBP, EUR/JPY, GBP/JPY, CHF/JPY, GBP/CHF, EUR/AUD, EUR/CAD, AUD/CAD, AUD/JPY, CAD/JPY, NZD/JPY, GBP/CAD, GBP/NZD, GBP/AUD, AUD/NZD"}
local I={"USD/JPY", "EUR/JPY", "GBP/JPY", "CHF/JPY", "AUD/JPY", "CAD/JPY", "NZD/JPY"}
table.sort(I)
strategy.parameters:addString ("Instruments", "Instruments", "", table.concat(I,","))
strategy.parameters:addInteger ("updateTF", "Update TF index", "1=m1 2=m5 3=m15 4=m30 5=H1 6=H2 7=H3 8=H4 9=H6 10=H8 11=D1 12=W1 13=M1", 0,0,13);
strategy.parameters:addInteger ("workingTF", "Working TF index", "1=m1 2=m5 3=m15 4=m30 5=H1 6=H2 7=H3 8=H4 9=H6 10=H8 11=D1 12=W1 13=M1", 8,1,13);
strategy.parameters:addInteger ("TradeYear", "Trade Year", "", 0);
strategy.parameters:addInteger ("TradeMonth", "Trade Month", "", 0, 0, 12);
strategy.parameters:addInteger ("Agent", "Agent", "", 1);
strategy.parameters:addString ("Currency", "Currency", "", "JPY");

This WAS running! the multi frame version WAS running too!
TakisGen
 
Posts: 34
Joined: Sat May 28, 2011 10:09 am

Re: Discussing How to Use Backtesting? article

Postby Alextc » Wed Jul 03, 2013 9:56 am

Hi, I apologize for my poor English. I want to know how I can filter the results exported in excel. The problem is that it exports everything that happened every 7 seconds and that creates lots of rows. Just need to know the operations performed.
I want to make a good analysis of the results and so I can not.
thanks
Alextc
 
Posts: 6
Joined: Wed Oct 03, 2012 4:59 am

Re: Discussing How to Use Backtesting? article

Postby Valeria » Thu Jul 04, 2013 6:24 am

Hi Alextc,

Please try to apply filter in the excel file for the Events column. For that go to the Sort and filter menu and click filter. After that click the arrow on the Events title and uncheck blanks.
Valeria
 

PreviousNext

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest