
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Based on previous versions of your source code submitted on a separate thread, it was clear that you were not detecting for the start of the bar and that you were acting upon every single tick irrespective of the time frame.
Read the following for how to only respond to the start of a new bar ...
Forum on trading, automated trading systems and testing trading strategies
Deleted topic "Strategy tester modelling methods"
Colin Kimble, 2025.01.04 14:30
Hi! I wanted to ask since the strategy tester has 4 modelling methods two of them ("Every tick", and "Every tick based on real ticks") calculates based on tick data, 1 minute OHLC calculates based on the OHLC of one minute, and Open Prices only only uses Open Prices, is there a way to test on bar close using only the open and close of each bar?Please read my previous post #11 for how to handle the opening of the bar.
Note that the OnTick() event handler, as the name indicates, is called on new tick events irrespective of when during the bar's duration they occur.
Also, one can not detect the close of a bar, as one can never know when the last tick will arrive. You will only be able to detect when a new tick arrives after the opening of the bar.
When using the "Open Prices Only" modelling, you are restricted only to the open prices which severely skews the results, especially for stops (Stop-loss and Take-profit).
For the most accurate modelling, use real ticks and select the testing range in accordance with the available tick data. That will give you the best environment of how your code will act when live, which is also ideal for debugging your code.
EDIT: If you don't have the necessary available tick data because the broker does not provided it for the testing period of interest, then rely on the normal virtualised "Every Tick" modelling.
Choose your broker wisely as reputable ones usually provide quite a lot of tick data. And don't use MetaQuotes demo accounts. Get a demo account from a regulated and reputable broker for your back-testing.
How do you suppose to use the open and close prices? You can use either of existing modes and use only open and close. Even in Open prices mode, the close is usually almost equal to next open, except for the gaps on weekends.
I understand, I was testing for FX markets which are closed Saturday and Sunday. The open and close usages was because all my indicator calculations are based off of the close of the bar, and I use the open to specify to buy underneath the open and sell above the open.
When you said," You can use either of existing modes and use only open and close." What would that entail specifically?
Based on previous versions of your source code submitted on a separate thread, it was clear that you were not detecting for the start of the bar and that you were acting upon every single tick irrespective of the time frame.
Read the following for how to only respond to the start of a new bar ...
Thank you for the information!
Please read my previous post #11 for how to handle the opening of the bar.
Note that the OnTick() event handler, as the name indicates, is called on new tick events irrespective of when during the bar's duration they occur.
Also, one can not detect the close of a bar, as one can never know when the last tick will arrive. You will only be able to detect when a new tick arrives after the opening of the bar.
When using the "Open Prices Only" modelling, you are restricted only to the open prices which severely skews the results, especially for stops (Stop-loss and Take-profit).
For the most accurate modelling, use real ticks and select the testing range in accordance with the available tick data. That will give you the best environment of how your code will act when live, which is also ideal for debugging your code.
EDIT: If you don't have the necessary available tick data because the broker does not provided it for the testing period of interest, then rely on the normal virtualised "Every Tick" modelling.
Choose your broker wisely as reputable ones usually provide quite a lot of tick data. And don't use MetaQuotes demo accounts. Get a demo account from a regulated and reputable broker for your back-testing.
Thank you for the guidence!
How do you suppose to use the open and close prices? You can use either of existing modes and use only open and close. Even in Open prices mode, the close is usually almost equal to next open, except for the gaps on weekends.
How come when using Open Prices mode does it show 4 trades being submitted when there are 5 trading days in the week?
The obvious reason is that your code is the cause, so put in a few Print() to output to the log any relevant information to find out why.
Or you can use the build in debugger. Use which ever method best suits your needs.
The obvious reason is that your code is the cause, so put in a few Print() to output to the log any relevant information to find out why.
Or you can use the build in debugger. Use which ever method best suits your needs.
Thank you for the advice! I have fixed the issue with that script, I have another script that uses a daily time frame and a one minute time frame. I have found if I use a EA that uses one time frame it is possible to run said EA in the Open Prices only model in the strategy back tester. Is it possible to run a EA that uses 2 different time frames (such as a Daily and one minute time frame) in the Open Price Only model in the strategy back tester? When I attempted this it kept on telling me how it is the wrong time frame (1 minute is the wrong time frame) request in a Open Prices testing mode.