I have created a custom indicator that compiles with zero error or warnings. Yet when I try to use it in an expert advisor using the iCustoms function it tell me the OnCalculate function is not found in the custom indicator. Has anyone else run into this problem and if so how did you correct it. I have attached the screenshot of both the compiled indicator and the failed expert. Any and all support to correct this error would be greatly appreciated.
Robert
Sorry about that David just was not thinking here is the attached codes, highlow seo ver1 is the indi and the other is the expert using the iCustom call.
Robert
You probably have called an outdated version of your indicator?
Your iCustom(..) requests: "lowhighseo ver0" and "lowhighseo ver2" - but you post "highlow_ seo_ver_1"( with OnCalculate() )?
You probably have called an outdated version of your indicator?
Your iCustom(..) requests: "lowhighseo ver0" and "lowhighseo ver2" - but you post "highlow_ seo_ver_1"( with OnCalculate() )?
The indicator was written by me last week so it is not outdated.
As far as the posting I have tried calling several version of the same indicator that all compile correctly but none work when custom called by the expert
Robert
Sorry about that David just was not thinking here is the attached codes, highlow seo ver1 is the indi and the other is the expert using the iCustom call.
Robert
you are using it wrong
iCustom returns an integer of the handle for the indicator and not the value of the indicator buffer
have a look at the documentation
you are using it wrong
iCustom returns an integer of the handle for the indicator and not the value of the indicator buffer
have a look at the documentation
Only in mt5 but not in mt4!
![iCustom - MQL4 Documentation iCustom - MQL4 Documentation](https://c.mql5.com/36/8/icustom-mql4-documentation.png)
This is the mql5 site... should post the query on the correct site
//#property indicator_chart_window
//+------------------------------------------------------------------+ //| lowhighseoexperradvisor.mq4 | //| Copyright 2016, Robert H Toutaint | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2016, MetaQuotes Software Corp." #property link "https://rtoutaint@gmail.com" #property version "1.00" #property description "This ea is for testing bar-since events" #property strict //#property indicator_chart_window #include <stderror.mqh> #include <stdlib.mqh> //--- input parameters extern double StopLoss=10; extern double TakeProfit=40; input double LotSize=0.12; extern int Slippage=30; extern int MagicNumber=963; double pips; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { // Determine what a pip is. pips =Point; //.00001 or .0001. .001 .01. if(Digits==3||Digits==5) pips*=10; //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { Checkforsignal(); } //+------------------------------------------------------------------+ //| Trigger | //+------------------------------------------------------------------+ void Checkforsignal() { static datetime candletime = 0; if(candletime != Time[0]) { //+------------------------------------------------------------------+ //| buy trigger | //+------------------------------------------------------------------+ double arrowup = iCustom(NULL,0,"lowhighseo ver_1",2,0); if(arrowup != EMPTY_VALUE) EnterTrade(OP_BUY); //+------------------------------------------------------------------+ //| sell trigger | //+------------------------------------------------------------------+ double arrowdown = iCustom(NULL,0,"lowhighseo ver_1",3,0); if(arrowdown != EMPTY_VALUE) EnterTrade(OP_SELL); candletime = Time[0]; } } //+------------------------------------------------------------------+ //| Trade type | //+------------------------------------------------------------------+ void EnterTrade(int type){ int err=0; double price=Bid, sl=0, tp=0; if(type == OP_BUY) price =Ask; //---- int ticket = OrderSend(Symbol(),type,LotSize,price,Slippage,0,0,"MAEA Trade",MagicNumber,0,Magenta); if(ticket>0){ if(OrderSelect(ticket,SELECT_BY_TICKET)){ sl = OrderOpenPrice()+(StopLoss*pips); tp = OrderOpenPrice()-(TakeProfit*pips); if(OrderType()==OP_BUY){ sl = OrderOpenPrice()-(StopLoss*pips); tp = OrderOpenPrice()+(TakeProfit*pips); } if(!OrderModify(ticket,price,sl,tp,0,Magenta)) { err = GetLastError(); Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err) ); } } else{//in case it fails to select the order for some reason Print("Failed to Select Order ",ticket); err = GetLastError(); Print("Encountered an error while seleting order "+(string)ticket+" error number "+(string)err+" "+ErrorDescription(err) ); } } else{//in case it fails to place the order and send us back a ticket number. err = GetLastError(); Print("Encountered an error during order placement!"+(string)err+" "+ErrorDescription(err) ); if(err==ERR_TRADE_NOT_ALLOWED)MessageBox("You can not place a trade because \"Allow Live Trading\" is not checked in your options. Please check the \"Allow Live Trading\" Box!","Check Your Settings!"); } }
![自动交易和策略测试 自动交易和策略测试](/i/community/logo_mql5_small.png)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have created a custom indicator that compiles with zero error or warnings. Yet when I try to use it in an expert advisor using the iCustoms function it tell me the OnCalculate function is not found in the custom indicator. Has anyone else run into this problem and if so how did you correct it. I have attached the screenshot of both the compiled indicator and the failed expert. Any and all support to correct this error would be greatly appreciated.
Robert