Hi folks,
I have been struggling with getting values from standard and custom indicators when using multiple TFs – e.g. if my EA runs on a H1 TF but I want to get the H4 Damiani value as a filter. Theoretically it should be possible, as I can specify the period in the iCustom function, but the results are not correct. I had the same thing when I developed an MTF MA EA, but there I could scale the period over which the MAs are calculated based on the chart period, so that one was quite easily solved, but with Damiani it’s not that easy, as it’s not simply a matter of calculating over more bars of the current chart. I’ve come to the conclusion that it’s a bug in MT, but maybe I’m doing something wrong. Here is the line calling iCustom:
Damiani1 = iCustom(NULL, PERIOD_H4, "Damiani_volatmeter", 0, 0);
I get all three values, and then use this line as a filter:
if (Damiani2 > Damiani1 || Damiani3 > Damiani1)
{
SellSignal = true;
BuySignal = false;
... etc.
Where Damiani2 and 3 are the other two buffers. Now this indy is a little difficult, as sometimes if I do mouse-over the green line, it shows Value2, and sometimes Value3, even when it’s above the grey line it changes, and it doesn’t seem to have anything to do with the straight red lines, so the above line should work from what I’ve seen of the indy.
Now look at the next two screens – first the H1, and then the H4 Look at the MA crossover on H1, and then the value of Damiani on H4 – which is what the EA is looking at, of course


As you can see (I was not working on close of bar, but the faster MA in the first pic crossed down, but then up again (I will consider working on close of bar, but backtests actually show better results using ticks – so far at least) so that is the first condition, but clearly in the second pic, the green line (Damiani2 or 3) is < the grey line (Damiani1) so that condition should not have been met, but yet the trade is placed as if the condition was met. Does anybody have any ideas about this?
Regards
Eben