The spread is fixed at the start of the tester run.
Has nothing to do with historical values.
When we test EA by strategy tester, is there "Bid","Ask", and so on data on the history tick? and if there is, the gap between "Bid" and "Ask" is what exist on history for some broker?
Thank you!
Hello "vx0532",
The "gap" between Bid and Ask is called the Spread. On some brokers it is a fixed value which the Strategy tester will assume when you set "Spread: Current" as "WHRoeder" has stated above.
However, on some brokers, this spread varies over time due to market conditions, so you can set the "Spread: " to a specific value in points that you wish to test on.
In my case, I usually test against the average value of spread to get the overall result and then also test with higher values to see if the EA can tolerate it or not.
As an extra note, if you want to track your broker's spread to see how it changes, have a look at my "Spread Tracker" < https://www.mql5.com/en/code/10983 >.
Best regards,
FMIC
Hello "vx0532",
The "gap" between Bid and Ask is called the Spread. On some brokers it is a fixed value which the Strategy tester will assume when you set "Spread: Current" as "WHRoeder" has stated above.
However, on some brokers, this spread varies over time due to market conditions, so you can set the "Spread: " to a specific value in points that you wish to test on.
In my case, I usually test against the average value of spread to get the overall result and then also test with higher values to see if the EA can tolerate it or not.
As an extra note, if you want to track your broker's spread to see how it changes, have a look at my "Spread Tracker" < https://www.mql5.com/en/code/10983 >.
Best regards,
FMIC
Ok, I know. Thank you very much.
how do you think about the EA if its result is very well when spread is set 5 and it becomes very bad when spread is set 10 even if the stop loss is enlarged.
Ok, I know. Thank you very much.
how do you think about the EA if its result is very well when spread is set 5 and it becomes very bad when spread is set 10 even if the stop loss is enlarged.
That really depends on the Strategy used in the EA and how the code manages the spread in accordance with the strategy rules. There is no way one can answer that without access to the EA in question.
But you can just run your strategy tester against your EA (or any EA) with the different values and see for yourself how the EA handles the differences and where the limits are.
In my own code, I usually test the Spread in the EA before placing an order, making sure it is below a certain limit spread value. For example, if after numerous tests in the Strategy Tester, I find that the EA is profitable only if the spread is no larger than say 1.8 pips, then I set that limit on the EA so that in only places orders if the spread is below that limit.
However, please note that the Spread in the tester is in "points" and not "pips". If you are testing for 5 or 10 pips and your broker is a 5-digit broker, the you will have to use 50 or 100 points to represent the same value in pips.
That really depends on the Strategy used in the EA and how the code manages the spread in accordance with the strategy rules. There is no way I one can answer that without access to the EA in question.
But you can just run your strategy tester against your EA (or any EA) with the different values and see for yourself how the EA handles the differences and where the limits are.
In my own code, I usually test the Spread in the EA before placing an order, making sure it is below a certain limit spread value. For example, if after numerous tests in the Strategy Tester, I find that the EA is profitable only if the spread is no larger than say 1.8 pips, then I set that limit on the EA so that in only places orders if the spread is below that limit.
However, please note that the Spread in the tester is in "points" and not "pips". If you are testing for 5 or 10 pips and your broker is a 5-digit broker, the you will have to use 50 or 100 points to represent the same value in pips.
Thank you for your time, FMIC
I find the spread can only be 2, 5, 10, 30, 50 or 100 points, so we can get the EA's result of spread on other value,such as 21, 15 and so on,yes?
I have test my EA, on spread 2, it is ok; spread 5, it is ok too; but on spread 10, it is bad. maybe the strategy have something wrong. do you have time and interest on its codes? if you have, email me. my email : delbet@qq.com
It is normal for an EA not to be profitable if the Spread is too high. It all depends on the strategy.
For example, a 1min or 5min scalping strategy is very sensitive to the spread, but a Day or Week (long-term) Trend following or even Breakout strategy can tolerate larger spread values.
If your EA cannot tolerate larger than 5 pips, then it probably is more of a short-term strategy (like the scalping) and probably you will have to monitor the spread in the EA so that it only trades when the spread is favourable.
It also depends on the Broker, for example on mine, the highest I have tracked on EURUSD was 4.4 pips. Maybe on other brokers it can be higher (or lower on ECN). What is the spread like on your broker and the symbol you use?
Usually the spread spikes during the opening and closing of the week and during news events. All your EA has to do is monitor the spread and not trade when that happens. You can use the "SpreadTracker" I mentioned before to get a feel of how the spread changes over a day or week ( or even over a month, if you are patient enough ).
It is normal for an EA not to be profitable if the Spread is too high. It all depends on the strategy.
For example, a 1min or 5min scalping strategy is very sensitive to the spread, but a Day or Week (long-term) Trend following or even Breakout strategy can tolerate larger spread values.
If your EA cannot tolerate larger than 5 pips, then it probably is more of a short-term strategy (like the scalping) and probably you will have to monitor the spread in the EA so that it only trades when the spread is favourable.
It also depends on the Broker, for example on mine, the highest I have tracked on EURUSD was 4.4 pips. Maybe on other brokers it can be higher (or lower on ECN). What is the spread like on your broker and the symbol you use?
Usually the spread spikes during the opening and closing of the week and during news events. All your EA has to do is monitor the spread and not trade when that happens. You can use the "SpreadTracker" I mentioned before to get a feel of how the spread changes over a day or week ( or even over a month, if you are patient enough ).
thank you
in the fact, my this EA is not scalping strategy or short term strategy, its strategy is as below:
You are not displaying the TimeFrame, Prices or the Currency Symbol, so I cannot know if it is short-term or not. You will have to be more forthcoming with some details if you want us to help.
I know that in the beginning new coders want to hide their strategy, but after a while you will learn that in real life it has all been said and done. There is not really much of any kind of new strategy that someone else has not already tried out. There is no "holy grail", just dedicated work and good money management.
However, if you feel that you want to keep some details to yourself, then that is OK too.
You are not displaying the TimeFrame, Prices or the Currency Symbol, so I cannot know if it is short-term or not. You will have to be more forthcoming with some details if you want us to help.
I know that in the beginning new coders want to hide their strategy, but after a while you will learn that in real life it has all been said and done. There is not really much of any kind of new strategy that someone else has not already tried out. There is no "holy grail", just dedicated work and good money management.
However, if you feel that you want to keep some details to yourself, then that is OK too.
hehe, I never that meaning, for last time I have asked whether you want to review my codes by email; but I don;t get your answer about it, so I think you don;t want to waste much time to review the codes.
Now I have attached the code on this reply's attachment for your reviewing; whatever I am very thankful to your time.
I use this EA(calling an indicator which is also been attached) on USDJPY pair, time frame is M15;
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
When we test EA by strategy tester, is there "Bid","Ask", and so on data on the history tick? and if there is, the gap between "Bid" and "Ask" is what exist on history for some broker?
Thank you!