Alerts from all timeframes?

 

Hi all!

I have a problem which I need some advice for. I would like to have automatic alerts (sound+popup, email, etc.) when certain rules are fulfilled in *any* given timeframes in a certain currency pair. I mean, if I for example would have an alert for ema(50) > ema(100), all timeframes from M5 to D1 would be checked for the rule after a new bar, and if it is true in any of them, an alert would be given.

And after that I could check the chart in a given timeframe and see if everything really is OK for my trade. And, maybe after a while, I could also make an EA out of it to automate the trades.

But, if I have understood correctly, EA's cannot draw lines such as EMA in a chart. So basically I should use a custom indicator for drawing the lines. But again, I don't know if it is anyhow possible to give alerts from any other timeframe than a current one in an indicator.

Is there anyway to solve my problem?

 

AlliumPorrum:

I would like to have automatic alerts (sound+popup, email, etc.) when certain rules are fulfilled in *any* given timeframes in a certain currency pair.

But, if I have understood correctly, EA's cannot draw lines such as EMA in a chart. So basically I should use a custom indicator for drawing the lines.

  1. Either code it to look at all timeframes, or code it to look at the current chart's timeframe and put in on multiple charts with different timeframes.
  2. EA's have no eyes. So if you want to see the lines, either you have to use an indicator, or (to come close) my polyline code (pre 600).
 
WHRoeder:
  1. Either code it to look at all timeframes, or code it to look at the current chart's timeframe and put in on multiple charts with different timeframes

Thanks WHRoeder!

Could you please give a few hints on how to code an indicator that can "look at all timeframes"? Are there any "dump-ass" instructions for this somewhere..?

 
AlliumPorrum: Could you please give a few hints on how to code an indicator that can "look at all timeframes"? Are there any "dump-ass" instructions for this somewhere..?
  1. Yes, you read the documentation - learn to code, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
  2. You asked:
    alert for ema(50) > ema(100),
    Did you bother to look at the documentation? What is the second parameter of iMA - MQL4 Documentation?
 

WHRoeder, I have coded dozens of indicators and EA's during the years, so I (think I) know the basics ;=) BUT, all that I have done previously are meant to be used just for one (= current) timeframe, and now I'm quite stuck with this multitimeframe problem. 

I try to describe it in a bit more detail...:

I have manually traded my strategy for a few months now, and since I'm using it for ~12 pairs , I would to automate at least the easiest parts of it so that I would not need to check it all the time. For these 12 pairs I'm using exactly the same method for D1, H4, H1 and M15 timeframes. I'm not actually looking for different timeframes to make one trade, but I'm looking every timeframe itself to fullfill all the rules for THAT timeframe's trade. So since I have 12 pairs * 4 timeframes, I would need to have 48 charts open if I would use single timeframe EA/indi. Not so good idea, I think...

My method is quite simple and uses just basic indicators, but still it requires 6 or 7 different rules to be checked everytime, i.e. 6 or 7 indicators must used. 

As you said EA's cannot draw lines, so I think I should use indicators.

But since I need about 7 lines to be drawn, and 4 different timeframes to be checked, wouldn't it mean that I need at least 28 buffers to check all rules from all timeframes? And since indicator has only 8 buffers, how can I make on indi that would alert me from any TF's trade, and also draw the lines & objects for any TF that I'm currently looking for?

And IF later on I would like to automate the trading by EA (and still always evaluate the trade and it's triggers from a chart), how can I do this with 12 * 4 rules to be checked?



PS. my comment about ema(50) > ema(100) was meant to be a pseudo code example, I know how to use iMa ;=)

 

Indicators don't need to be tied to a particular chart or even a particular symbol.

For example, you can have an indicator applied to EURUSD M1 that is checking USDJPY H1, XAUUSD D1 and USDCHF M30 if you want.

You can run the checks on a timer, so you don't need to worry about whether a tick has come in on the current chart in order to trigger a check of the other symbols which have changed. 

You'll want to have a look at iBarShift 

AlliumPorrum:

And since indicator has only 8 buffers,

 Indicators can have up to 512 buffers now - IndicatorBuffers.

Try google for some dashboard code to get ideas about working with multi timeframes and multi symbols.

 

Thanks honest_knave!

honest_knave:

Indicators can have up to 512 buffers now - IndicatorBuffers.

So is it really possible to draw up to 512 lines on one indicator on MT4?? Has this changed at some stage, because I really thought that 8 is maximum... ?

 

Yes, the number of buffers was increased.

I've never tried anywhere close to that many buffers, but I have no reason to doubt the documentation. It'd be a hungry indicator.

 

Well that's nice to hear :=)

So basically I should just code one multi timeframe indicator, and if I later on want to automate the trades, I will just use some of the indi's buffers to give buy/sell indications to the simple EA checking out just this one indicator.

Thank you guys!

 
But hey, one more thing; is it possible to use backtesting (& optimization) for a multitimeframe EA? I mean, can all timeframes be tested at the same basktest run, or should every time frame be tested separately on their on charts?
Reason: