The greatest difficulty I'm having at the moment is with Custom Indicators that work fine in the MT4 terminal but whose signals can't be called properly. For example the well-known Magic Trend (enclosed) displays two lines:blue when the market is trending upwards, and red when it is trending downwards. On any Time Unit the Trend Magic signal (mode 0) is positive in upward markets while the corresponding Value 2 signal (mode 1) is nil (no value is indicated ...). The Trend Magic signal (mode 0) is nil and the Value 2 signal is positive (mode 1) in downward markets. When the colour changes both signals appear as positive and equal in the MT4 terminal. However none of the following code lines works properly: if Mode (0,1) < Mode(0,0) then BUY if Mode (1,1) > Mode (1,0) then SELL if Mode (1,0) = Mode (0,0) && Mode (1,1) < 0 then CLOSELONG if Mode (1,0) = Mode (0,0) && Mode (0,1) < 0 then CLOSESELL I've tried to retrieve the values of both signals by adding the following lines in the SENDMAIL order of the .mq4 file: mailstring = StringConcatenate(mailstring, "MagicTrendUp: ", iCustom(Symbol(),0,"trend-magic", 50, 5,0,0), "\n"); mailstring = StringConcatenate(mailstring, "MagicTrendDown: ", iCustom(Symbol(),0,"trend-magic", 50, 5,1,0), "\n"); The resulting e-mail alerts on my mobile do not correspond at all with the values displayed in the MT4 charts and the values of the signals left blank in the MT4 terminal are not "0" but "2147483647". What do I have to make of all this? How can one exploit such an indicator to make an EA? Thanks a lot in advance for any light your could shed on the matter. Regards.
|