strategy testing a indicator

rjd007

Member
I am new to MT4 so I have a couple of testing questions. I have taken an MA indicator and added the order info to it and now I want to do a strategy test to set some of my param. I am also using s-constant range bars but it will not test. So here are my questions:

1. Do I have to convert the indicator over to a EA before I can back test? If I do, how?

2. Can you strategy test range bar charts? If so, how. The 2M chart is not available for my template.

Thanks
 

stovedude

Active member
Ok. Here is one solution for range bar testing. Go into your MT4/history/demo (or live) server folder (whichever one has the data that you have been working with lately) and delete the M1 or M5 .hst file (such as EURUSD1.hst or EURUSD5.hst). Also, you will need to make sure you do not have this particular TF open in your platform, or it could get written back into the folder again. Now, rename your M2 (which will be like EURUSD2.hst) to the same name as the one you deleted. Then, go to your platform strat tester and choose this same TF for the test and choose Visual as well, and the tester will open your range bar chart. You can attach your indicator onto the visual chart. I have no idea if an indicator is allowed to make trades on the BT, but I guess it's possible.
Another solution: convert the indicator to an EA and change any and all calls to other indicators, including test for Highs,Lows,Closes,Opens, to the M2 TF (i.e. indicator calls such as iCCI(NULL,0,..... will be changed to iCCI(NULL,2,..... and High[x] will be changed to iHigh(NULL,2,x), etc). This way, you can test on any TF without major changes.
 

rjd007

Member
Thanks for the feedback on the TF issue. Now I am having issues with triggering my trade at the start of a new bar. I have been using:

LastAlertTime < Time[0]

But this doesn't work with the strategy tester. Does anyone have any suggestions?

Thanks
 

stovedude

Active member
You can use Time[0], but you can't use TimeCurrent(). It must be another issue. I normally use this equation: LastAlertTime!=Time[0] , but yours should work.
 

Aurix Exchange
Top