There is something which I cannot understand about EA and Metatrader.
After setting the EA, does the price action rely on the current price tick or the chart chosen.
Example is, if my EA set to buy when price move above day high. My expectation is to buy immeidately as if I am sitting in front of the computer. However if I set the EA on H4 , H1 , M30 or M15 , does it make any difference ?
Suppose if use current price tick then should open immeidately right ? Or is it if I am using H1, the price open not until the next bar appear ?
Many thanks for any explaination anyone can help .
I think it depends on the ea but for the most part ea’s will trade on whatever chart data they are on, so if you have an ea on a 5minute chart then it will trade based on the 5minute data. For example if the ea relies on certain indicators or conditions to be met it will base it’s trade decisions on the data from the chart that it is on.
so it trade base on the chart date and not the live price tick ?
so if my EA simply is to buy if move above previous high and I use H4, that mean no trade until after 4 hours at the next bar ?
Let me understand…you want to trade when the current price goes above the high of the previous day, or a price reached for the current day?
Either way, you’ve got that price stored somewhere, correct? Then, for a long trade, you compare “Ask” (the current price tick) against that and make your decision. Here, you would not be using data from 5, 15, 60, etc. minute bars (e.g., open[], close[], etc.). You just have to look at “Ask”…compare it against your previously-stored “high for the day” value. So I don’t think your EA would care what timeframe is selected for the chart.
Now, if your own strategy is to wait until the current bar closes…that’s another issue. If you want you can wait until the current bar closes (number of bars changes) and I think High[1] contains the high price value for the finished bar…and High[0] has the current high for the new bar which isn’t finished.
Thanks everyone !
Thats exactly where I am confuse.
My idea is to buy whenever the current price move above a pre-set level.
My thinking is the chart and EA only help me to determine [I]that pre-set level[/I] and therefore it should not matter what time frame chart I use. And that should mean [I]the preset level (example high of last hour)[/I] and eventual entry price should be the same whatever timeframe use.
However when I do back testing, results are different using H1, H4 and M30 which is why I am confuse. And it is hard to do real live testing.
For the example…high of last hour…where do you get it?
Do you manually compare each tick data to a stored high? Or do you get it from High[0]? The latter is dependent on the timeframe of the chart…this is probably why you get different results for each timeframe.
You can get the high this way…
iHigh(“USDCHF”,PERIOD_H1,i)
you specify the period (e.g., 1 hour) and then it shouldn’t matter what timeframe is selected on the chart. i = shift (0 = current bar, 1 = last bar, etc.). This would be the high for one 1-hour bar. See the mql4 website for functions like this!