Without any information how your EA decides to buy/sell this is difficult to answer.
We see in the market a lot of situations where one bar has a very big size (for example on important news).
So the tester generates up to 11 ticks for such a bar. Depending on your logic it acts very different (in testing alone).
If you would use your EA with real money I am quite shure it will be much worse because such big bars may have up to 200 ticks in one minute.
I assume that your logic acts on the current bar, you should try your logic with the values of the previous bar.
Best wishes
Uwe
Without any information how your EA decides to buy/sell this is difficult to answer.
We see in the market a lot of situations where one bar has a very big size (for example on important news).
So the tester generates up to 11 ticks for such a bar. Depending on your logic it acts very different (in testing alone).
If you would use your EA with real money I am quite shure it will be much worse because such big bars may have up to 200 ticks in one minute.
I assume that your logic acts on the current bar, you should try your logic with the values of the previous bar.
Best wishes
Uwe
I send now a trick for only "ticking" in one bar. You just have tu put this logic at the beginning of the tick. If the bar is not new then exits...
In which situations do you think that this trick may work well?
//--- Let's first check if a new bar has come! if(CopyTime(_Symbol, _Period, 0, 1, m_currentBarTime) > 0) { if(m_previousBarTime != m_currentBarTime[0]) { m_isNewBar = true; m_previousBarTime = m_currentBarTime[0]; } } else { Alert("Error copying historical data, error: ", GetLastError()); return; } if(!m_isNewBar) return;
What would you also recommend to solve those extra ticks? Is there an article or so explaining this? Thank you.
I send now a trick for only "ticking" in one bar. You just have tu put this logic at the beginning of the tick. If the bar is not new then exits...
In which situations do you think that this trick may work well?
What would you also recommend to solve those extra ticks? Is there an article or so explaining this? Thank you.
Without any information how your EA decides to buy/sell this is difficult to answer.
We see in the market a lot of situations where one bar has a very big size (for example on important news).
So the tester generates up to 11 ticks for such a bar. Depending on your logic it acts very different (in testing alone).
If you would use your EA with real money I am quite shure it will be much worse because such big bars may have up to 200 ticks in one minute.
I assume that your logic acts on the current bar, you should try your logic with the values of the previous bar.
Best wishes
Uwe
hi,
what do you mean using the values of previous bar? use maVal[1] (where maVal contains moving average values and the array is set as series) instead of maVal[0]?
or check whether the condition have been verified during the last bar and so enter on the opening of this bar?
below part of the code of my very simple EA
triggerLong=maVal[1]-diff; triggerShort=maVal[1]+diff; ...... ....... Buy_Condition_1=(now_ask<triggerLong); Sell_Condition_1=(now_bid>triggerShort); Exit_long_Condition=(closeAtCross? now_ask>=maVal[1]:false) || Sell_Condition_1; Exit_short_Condition=(closeAtCross? now_bid<=maVal[1]:false) || Buy_Condition_1;
whether I use maVal[1] or maVal[0] the situation doesn't change thath much, the ohcl is still profitable while every tick is not.
thanks
Without any information how your EA decides to buy/sell this is difficult to answer.
We see in the market a lot of situations where one bar has a very big size (for example on important news).
So the tester generates up to 11 ticks for such a bar. Depending on your logic it acts very different (in testing alone).
If you would use your EA with real money I am quite shure it will be much worse because such big bars may have up to 200 ticks in one minute.
I assume that your logic acts on the current bar, you should try your logic with the values of the previous bar.
Best wishes
Uwe
What do you mean by "to solve those extra ticks" ?
I absolutely agree with ugo58. Big bars can trigger the event OnTick many times, while small bars will trigger it much fewer.
This can have an impact on your automated trading strategy, so we developers have to look for solutions that mitigate the fact that your event OnTick may be executed many many times per bar.
I think that what I sent before is just one solution. ugo50 proposed another solution: running your OnTick logic in the most recent past bar. Anyway, if you want to run your OnTick logic on the current bar maybe you can use something similar to what I sent before.
We are trying to implement something like a OnBar event.
What do you think about this?
hi,
what do you mean using the values of previous bar? use maVal[1] (where maVal contains moving average values and the array is set as series) instead of maVal[0]?
or check whether the condition have been verified during the last bar and so enter on the opening of this bar?
below part of the code of my very simple EA
whether I use maVal[1] or maVal[0] the situation doesn't change thath much, the ohcl is still profitable while every tick is not.
thanks
There is obviously a big difference if your code use maVal[1] or maVal[0], or in general if you are working on Closed bar only or on Open bar or inside a bar.
In the last case you need to use Every tick mode, all others mode aren't appropriate.
Thx. Oh, well. One of things I just had to relearn. ;)
As I said it depends on your logic.
Their are a lot of ways to solve those issues, maVal[1]is one of the easier solutions as moving averages may not change so fast on each bar (depending on period length and smoothing method).
That could be different if for example you depend on a high and low of a range of bars.
- 2010.10.11
- Konstantin Gruzdev
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm getting complete opposite result when testing on every tick or 1min OHLC. the EA and input parameters are exactly the same but in the case of 1min ohlc I get 50000 profit while in every tick I get -7000 losses.
this happens on many pairs testing on a period of 2 years 0811-0813
someone have had the same problem? I don't understand what is the problem here and what shall I do when trading real money.
both graph below
1minute OHLC
every tick