Expert Advisor and Third Party Indicator

 

Hi all, I am a beginner here and new to EA.

I have a third party indicator and would like to make auto trading based on the signal. However, I am not sure how to get the value in EA.

From doc, I know there is function called iCustom to get indicator value but I always get 0 from the return.

https://docs.mql4.com/indicators/icustom

iCustom - Technical Indicators - MQL4 Reference
iCustom - Technical Indicators - MQL4 Reference
  • docs.mql4.com
[in]  Custom indicator compiled program name, relative to the root indicators directory (MQL4/Indicators/). If the indicator is located in subdirectory, for example, in MQL4/Indicators/ The passed parameters and their order must correspond with the declaration order and the type of extern variables of the custom indicator...
 
Show your code
 
#property copyright   "2005-2014, MetaQuotes Software Corp."
#property link        "http://www.mql4.com"
#resource  "\\Indicators\\Market\\Trend Channels.ex4"

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick(void)
  {
   double value;
   value = iCustom(NULL, 0, "\\Indicators\\Market\\Trend Channels.ex4",MODE_MAIN,0);
   Alert("value: " + value);
//---

  }

I use default parameter.

MQL4: automated forex trading, strategy tester and custom indicators with MetaTrader
MQL4: automated forex trading, strategy tester and custom indicators with MetaTrader
  • www.mql4.com
MQL4: automated forex trading, strategy tester and custom indicators with MetaTrader
 
vincent2020:

Checked GetLastError()?

Anyway, you can try bar 1, if still zero, try 1 instead of MODE_MAIN (which just happens to be 0).

If these still return zero, people here will need to play around with your "Trend Channels.ex4" if you still need help...

Reason: