How to call this custom indicator values in mt5 expert with iCustom option. I don't understand, read many articles and posts. no answer anywhere. please help me. Thank you.
- Machine learning in trading: theory, models, practice and algo-trading
- ICustom function
- Multi Currency Indicator with USD Indicator- Please some one help me to calling indicator values in Expert mql5
- www.mql5.com
Perhaps you should read the manual. You don't call indicators. You read the buffers with iCustom.
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2018)
We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
No free help (2017)
Thanks brother. I already tried with that code. But the calue is coming 1 only.. not real value. can you please give me sample.
Brother this is what i tried. as shown in that link but the value is coming only 1 always..
//+------------------------------------------------------------------+ //| Moving Averages.mq5 | //| Copyright 2009-2017, MetaQuotes Software Corp. | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2009-2017, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" #include <Trade\Trade.mqh> #property indicator_separate_window #property indicator_buffers 1 #property indicator_plots 1 double aug[] ; int MA_handle; //+------------------------------------------------------------------+ //| Calculate optimal lot size | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Position select depending on netting or hedging | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit(void) { SetIndexBuffer(0,aug,INDICATOR_DATA); ResetLastError(); MA_handle=iCustom(NULL,0,"Markets\\multi_usd_ind", 0, 0 ); Print("MA_handle = ",MA_handle," error = ",GetLastError()); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick(void) { } void OnDeinit(const int reason) { } //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- Copy the values of the indicator Custom Moving Average to our indicator buffer int copy=CopyBuffer(MA_handle,0,0,rates_total,aug); Print("copy = ",copy," rates_total = ",rates_total); Comment( "\n copy: "+DoubleToString(copy,4) ); //--- If our attempt has failed - Report this if(copy<=0) Print("An attempt to get the values if Custom Moving Average has failed"); //--- return value of prev_calculated for next call return(rates_total); }
Hi!
1) You create handle of indicator by iCustom(). It is better to do in in OnInit().
2) You use CopyBuffer() for getting values from created handle.
Brother this is what i tried. as shown in that link but the value is coming only 1 always..
You must NOT mix OnTick() and OnCalculate(), one is only for EAs one only for indicators!
You should study(!):
Quickstart for newbies: https://www.mql5.com/en/articles/496
and: https://www.mql5.com/en/articles/100
cookbook: https://www.mql5.com/en/search#!keyword=cookbook
Bear in mind there's virtually nothing that hasn't already been programmed for MT4/MT5 and is ready for you - so searching gives better results than AI or ChatGPT!
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use