Multi Time Frame EA/Signal Question - Help Please

 

Hi,

I was chatting with a developer and he has told me that MT4 has problems using multiple time frames in an EA.

I use the following to identify forward trend and then look for lower time frame entry points:

int index = 0;

         StDev=iStdDev(NULL,PERIOD_D1,10,0,MODE_EMA,PRICE_MEDIAN,index+1);
         StDevBack1=iStdDev(NULL,PERIOD_D1,10,0,MODE_EMA,PRICE_MEDIAN,index+2);
         StDevBack2=iStdDev(NULL,PERIOD_D1,10,0,MODE_EMA,PRICE_MEDIAN,index+3);
         StDevBack3=iStdDev(NULL,PERIOD_D1,10,0,MODE_EMA,PRICE_MEDIAN,index+4);
         StDevAverage=(StDev+StDevBack1+StDevBack2+StDevBack3)/4;     
         //---End Daily Trend                
         //---Price
         DailyPrice=(iHigh(NULL,PERIOD_D1,index+1)+iLow(NULL,PERIOD_D1,index+1))/2;
         DailyPrice1=(iHigh(NULL,PERIOD_D1,index+2)+iLow(NULL,PERIOD_D1,index+2))/2;
         DailyPrice2=(iHigh(NULL,PERIOD_D1,index+3)+iLow(NULL,PERIOD_D1,index+3))/2;  

         SmaH4200=iMA(NULL,PERIOD_H4,200,0,MODE_SMA,PRICE_MEDIAN,index+1);

         Price=(High[index+1]+Low[index+1])/2;(on 1H chart)

if(DailyPrice>DailyPrice1 && DailyPrice1>DailyPrice2 && StDev>StDevAverage)
         if(Price>SmaH4200)

          then further if parameters on lower time frames

Is it true that EAs on MT4 have problems operating longer to shorter time frame parameters when producing a trade signal?

Any guidance would be helpful ??

Regards Mike

 

Please don't double post.

 

ok Marco I was told to add it to another relevant field, as part of an overall EA code, I though it better to post it under auto trading question.

So is it true MT4 has a problem converting both longer and shorter based time frame when used in conjunction within a single EA to produce a trading signal?

 
Michael Green: So is it true MT4 has a problem converting both longer and shorter based time frame when used in conjunction within a single EA to produce a trading signal?

No it is not true! Whomever told you that did not know what he was saying.

You just have to code it properly and handle the delay's associated with downloading the data for other symbols and time-frames by detecting and handling 4066 and 4073 errors. You also have to use iBarShift to sync up the different time frames. Obviously this requires a developer with better skills than the average or newbie coder.

There are several threads on the forum on the subject, but here are a few:

By the way, I see that you have already received answers on your other thread, so why are you ignoring them?

Forum on trading, automated trading systems and testing trading strategies

MTF Code Issue

whroeder1, 2017.11.25 17:03

  1. Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. On MT4: Unless the current chart is the specific pair/TF referenced, you must handle 4066/4073 errors.
              Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum

  3.  DailyPrice=(iHigh(NULL,PERIOD_D1,index+1)+iLow(NULL,PERIOD_D1,index+1))/2;
    
             SmaH4200=iMA(NULL,PERIOD_H4,200,0,MODE_SMA,PRICE_MEDIAN,index+1);
    
     Price=(High[index+1]+Low[index+1])/2;(on 1H chart)
    You don't show your code's context. We have no idea what index is, but it can't be a shift for the D1, a shift for the H4, and a shift for the chart period (H1 according to your comment) at the same time.
              Don't mix apples and oranges.