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 station0524 » Tue Sep 06, 2011 10:00 pm

How does one back-test a certain time period period? For instance, I want to test how a strategy performed just for the month of August 2011 and March 2011. Obviously it would have to be two different tests, but can it be done?
station0524
 
Posts: 25
Joined: Sat May 14, 2011 4:30 pm

Re: Discussing How to Use Backtesting? article

Postby sunshine » Wed Sep 07, 2011 5:09 am

You can backtest for one time period first, and then for another.
Just download necessary price data from fxcodebase price archive and choose appropriate file in backtest parameters.
Unfortunately data for August is not available there right now. But we will update the archive today.
sunshine
 

Re: Discussing How to Use Backtesting? article

Postby titi82000 » Tue Oct 04, 2011 2:57 pm

There is something not clear about backtesting VIA marketscope (under strategy manager -> bactkest function then choosing your strategy). It seems to backtest ONLY one stream of data per min for instance if you run a 1 min data chart, and it DOES NOT use 8 simulated market data inside each min bar.
DO WE NEED TO ADD SOMETHING IN THE STRATEGY code so that the marketscope backtest simulation runs as the one in the strategy debugger (via the backtest button)ie using 8 data points for each bar you enter as instance stream for the backtest. Thanks to clarify this point.

A distorsion happens if you tell the strategy to buy next stream point, in the backtest in a 5 min bar chart, it will happen 38s (5 min/8 roughly) later while in the marketscope backtest function, it will send the order the next bar that is 5 min later!! which is completely different. Yet that in real condition, depending of you connectivity, i suppose next stream is inside 1 s for most liquid currencies ...
titi82000
 
Posts: 10
Joined: Tue Oct 04, 2011 2:45 pm

Re: Discussing How to Use Backtesting? article

Postby sunshine » Wed Oct 05, 2011 5:33 am

Hi,

With the current version of Marketscope, you can choose price simulation type in the Backtester properties:
mode.PNG

If you choose the Close value, this means that only one tick will be simulated per period.
In all other cases, 11 ticks per period will be simulated.

Please note that the beta version of FX Trading Station/Marketscope which provides powerful tools for backtesting and optimizing is now available on the site. With this version, you can backtest and optimize your strategies using new ultra-realistic and high-precise market simulator.

You can read more about the beta version and download it here:
viewtopic.php?f=30&t=6490

Please also note that the beta version is installed in addition to the production version of the FX Trading Station. It does not replace the production version, so both version can be used simultaneously, in the same time.
sunshine
 

Re: Discussing How to Use Backtesting? article

Postby titi82000 » Wed Oct 05, 2011 1:21 pm

Hi sunshine,
This is a really great answer! I did not look carefully to the legend. Now, I am just wondering about what are the differences between high low close and low high options if the market simulation pattern is only ONE, the one explain in the wiki pages. Indeed, it should depend more on an ascending or an descending bar than to this two kind of options. Could you clarify that point please? And additionally, someone (with the rights) could please add a note on the wiki page (http://fxcodebase.com/wiki/index.php/Price_Simulation) so that nobody will be confused in the future. I know I can figure out by myself by comparing bars per bars the logic in the debugger and in marketscope but this will be more efficient to add this information in the wiki page too.

You are right, I was refering to the current released 2.0 version of Marketscope. Now I am going to see the new functionalities 8-) of the beta version . The first change is that it seems you can run/backtest compiled strategies which was not the case before (correct me if I am wrong, by before I mean in the current release). I want to add this compiled (bin) word in this thread since i did not find any subject when searching articles about it. So now, we can distribute strategies and let people backtest them with their own idea (in case the strategies has a lot of different parameters) without having to know the code. Am I right?
Also, it seems to take the functionalities of the strategy debugger inside the marketscope design which is a nice job.
I just can't wait the next release which should come really soon :roll: :D .
Thanks for the effort you are doing in this forum! Really useful information.
titi82000
 
Posts: 10
Joined: Tue Oct 04, 2011 2:45 pm

Re: Discussing How to Use Backtesting? article

Postby sunshine » Thu Oct 06, 2011 4:51 am

titi82000 wrote:Hi sunshine,
Now, I am just wondering about what are the differences between high low close and low high options if the market simulation pattern is only ONE, the one explain in the wiki pages.


The article Price Simulation in wiki discusses simulation of prices in the new beta version of Marketscope and Indicore SDK 2.0.
Unlike the current Marketscope version and SDK 1.0, in new versions there is only one tick simulation mode: 8 ticks per 1 bar of the source data.

As for the modes High-Low-Close (HLC) and Low-High-Close (LHC). In the HLC mode prices go to high, then to low, then to close; in the LHC mode, the prices go to low, then to high, then to close. It is discussed in the original article for which this thread is created (the link is in the top post of this thread). Please see Price Simulation in the current version of Marketscope and Indicore SDK 1.0.

However, it is statistically proved that the candles rather follow HLC for descending candles and LHC for ascending candles, so, the market will move rather using this pattern than in other way.
That is why in the new version only this pattern is used.

titi82000 wrote:Now I am going to see the new functionalities 8-) of the beta version . The first change is that it seems you can run/backtest compiled strategies which was not the case before (correct me if I am wrong, by before I mean in the current release)


The current version allows you to work with strategies (create and test them) in the .bin format as well. But to create a strategy/indicator in the .bin format for the current version, you should use Indicore SDK 1.0. It can be downloaded here: http://www.fxcodebase.com/wiki/index.ph ... ore_SDK%3F

I hope this will help.
Please do not hesitate to post with any other questions.
sunshine
 

Re: Discussing How to Use Backtesting? article

Postby Nikolay.Gekht » Thu Oct 06, 2011 8:21 am

I do not recommend to compile into bin using SDK 1.0 at all. Since virtual machine for Lua has been changed in further Marketscope release which comes to production pretty soon, you will be anyway need to recompile bin files. Due to new LuaVM limitation, the new binary format is incompatible with old (SDK 1.0) binary format. We understand inconvenience, but better performance worths it. Just wait a couple of weeks.
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1223
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Discussing How to Use Backtesting? article

Postby titi82000 » Thu Oct 06, 2011 1:04 pm

Sunshine and Nikolay.Gekht, thank you for developing the subject on compiling & backtesting. I was maybe a bit clumpsy to explain why I had some problems with bin files and with backtests results via Marketscope 2.0 vs SDK2.0 when I was comparing tick by tick the results since I did not notice the compiling issue Nikolay is refering to. But now that I understand the differences between beta TS, SDK2.0 and in the other side, the current Marketscope 2.0 and SDK1.0 this is a huge anxiety that you took me off .. and I will wait for the next release which will be such a great improvment for current users as me (of the SDK2.0 tools) and for future users.
titi82000
 
Posts: 10
Joined: Tue Oct 04, 2011 2:45 pm

Re: Discussing How to Use Backtesting? article

Postby LordTwig » Fri Feb 03, 2012 10:47 am

I changed some parameters in your strategy... MA_ADVISOR and saved it as ....MA_ADVISOR2 also saved the resource file as .....MA_ADVISOR2.lua.rc
I tried to use OptimiZer - Backtester for this adjusted strategy but it won't work (and yes,....I have imported the file to tradestation)

I did get several errors in Stratergy Parameters of optimizer, so I updated the resource file and fixed this problem (I added several of the missing resources info)

But I now get this error message....... :226 attempt to concatenate global 'Buy' (a nil value)

Not sure why as standard MA_ADVISOR works in Optimser, ......how to fix?
Is there a different Resource file used somewhere for the Backtesting????

BTW..... How exactly do you insert an image into these posts???..... article?? : :)

Cheers
Lordtwig
Cheers
LordTwig
LordTwig
FXCodeBase: Confirmed User
 
Posts: 157
Joined: Fri Mar 12, 2010 3:15 am

Re: Discussing How to Use Backtesting? article

Postby PipGrabber » Fri Feb 03, 2012 4:52 pm

LordTwig wrote:I changed some parameters in your strategy... MA_ADVISOR and saved it as ....MA_ADVISOR2
I tried to use OptimiZer - Backtester for this adjusted strategy but it won't work (I have imported the file to tradestation)
So I also saved the resource file.....MA_ADVISOR.lua.rc as .... MA_ADVISOR2.lua.rc. ......Still won't work!

I get several errors in Stratergy Parameters of this type "Can't find the string in resources.", "cant find account details", for these params.......Price, Slow moving average, moving average, Bid, Ask, recurrent, send email.
Have tried adding some to resource file still no works.


What am I doing wrong and how to fix?
Is there a different Resource file used somewhere for the Backtesting????

BTW..... How exactly do you insert an image into these posts???..... article?? : :)

Cheers
Lordtwig


Hello Lordtwig,

We have the same predicament.. I too was modifying the ma_advisor and got the same errors as yours. But after some thorough review, you also need to include that common.lua.rc on the same folder of your modified ma_advisor. And it would work, w/o those errors. You can clearly see on the rc file, the first line states include common.lua.rc. Hope that helps.

On the same note. My edited ma_advisor also to be just a CLOSE strategy. I just remark the buy/sell function as comment. But somehow it doesn't close open trades manually or those created by other strategies. But the terminal message alert says its closed. But the open trade is still there. I wonder if it detects open trades during enum. What could be the cause of such? (theoretically it should work right?)
User avatar
PipGrabber
 
Posts: 46
Joined: Fri Jan 21, 2011 9:22 am

PreviousNext

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 4 guests