EA: Check conditions in different time frames

Back to topics list To post a new topic, please log in or register
eddieTrader 2015.04.30 11:04


In my fisrt EA that I am writing, I am checking some conditions from indicators in 1D, 4H and 1H.

All the indicators are written on its respective time frame.

The problem that I am having is that, when using test strategy,  I check the conditions to place a sell/buy order, and it does not work.

I am using the classic:

     if ( (condition_1D) && (condition_4H) && (condition_1H) )   sell/buy order  -----> that does not work

The expression above does not work, however, I have tested each condition alone:

    if (condition_1D) sell/buy    ---> that works

    if (condition_4H) sell/buy    ---> that works

    if (condition_1H) sell/buy    ---> that works

So, why are they not working together? what I am missing?.


manuel_campelo 2015.04.30 13:02 #
With that info cannot answer, send some code if you wish for an answer. It may be the way conditions are constructed or anything else.
eddieTrader 2015.04.30 13:55 #

Hi Mafecaro,


Thanks for your answer, I do not have the code right now, but I will have it.


However, the question is more focused on, if it is possible to test a strategy with conditions from different TF, I mean, if the strategy tester works for all TF in MT4. Since I have seen that, when you want to test an strategy you must select the TF, and you cannot navigate the TF's while the strategy is being tested...that makes me think..



WHRoeder 2015.04.30 17:13 #
  1. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  2. Post the actual code (src), with printout of variable values, before and inside if statements so you can find out why.
  3. Check your return codes (OrderOpen and OrderSelect) What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
Back to topics list  

To add comments, please log in or register