The drawing style 'DRAW_ARROW' does not create graphic objects. Therefore, you cannot find these objects in the object list.
What should I use in place of 'DRAW_ARROW'?
What should I use in place of 'DRAW_ARROW'?
It is not at all clear why you want to see objects in the general list?
Just keep using the 'DRAW_ARROW' style - this is the most correct approach.
It is not at all clear why you want to see objects in the general list?
Just keep using the 'DRAW_ARROW' style - this is the most correct approach.
I want to write an EA that opens a trade when an arrow is drawn on the index 1 candlestick. The idea is once it's drawn on the chart I should be able to access the object in my EA code. There might be a way to access them directly from the indicator without doing that, but I'm not sure how that could be done.
I want to write an EA that opens a trade when an arrow is drawn on the index 1 candlestick. The idea is once it's drawn on the chart I can easily access the object in my EA code. There might be a way to access them directly from the indicator without doing that, but I'm not sure how that could be done.
You just need in an advisor: create an indicator handle (once in OnInit ()) and then receive data from the indicator buffer.
Everything is very simple. Read help: iCustom . See examples: An example of working with the ZigZag indicator.

- www.mql5.com
You just need in an advisor: create an indicator handle (once in OnInit ()) and then receive data from the indicator buffer.
Everything is very simple. Read help: iCustom . See examples: An example of working with the ZigZag indicator.
To be honest, I am don't fully understand how to implement the example to get the arrow object. I think I've been able to figure out how to get the moving averages but not the arrow object. Below is the code iCustom EA I've written:
double MA[]; int MA_handle; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { MA_handle=iCustom(NULL,PERIOD_M1,"R_IND"); return(0); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { CopyBuffer(MA_handle,0,0,3,MA); ArraySetAsSeries(MA,true); Print( "h MA[1]: "+MA[1]); }
First, create and design your indicator correctly - at least the indicator should have a NAME and EXTENSION. Publishing a PIECE of code without a HAT, without a NAME and without an EXTENSION is bad form in programming.
An example of creating an indicator:
Example of creating an indicator based on iATR

- 2020.07.05
- www.mql5.com
First, create and design your indicator correctly - at least the indicator should have a NAME and EXTENSION. Publishing a PIECE of code without a HAT, without a NAME and without an EXTENSION is bad form in programming.
An example of creating an indicator:
Example of creating an indicator based on iATR
Here is the complete working indicator:
//+------------------------------------------------------------------+ //| MyScalpIndicator.mq5 | //| Copyright 2019, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property description "" //--- indicator settings #property indicator_chart_window #property indicator_buffers 2 #property indicator_plots 2 #property indicator_type1 DRAW_ARROW #property indicator_width1 5 #property indicator_color1 0xFFAA00 #property indicator_label1 "Buy" #property indicator_type2 DRAW_ARROW #property indicator_width2 5 #property indicator_color2 0x0000FF #property indicator_label2 "Sell" //--- indicator buffers double Buffer1[]; double Buffer2[]; datetime time_alert; //used when sending alert input bool Audible_Alerts = true; double myPoint; //initialized in OnInit int MA_handle; double MA[]; int MA_handle2; double MA2[]; double Open[]; void myAlert(string type, string message) { if(type == "print") Print(message); else if(type == "error") { Print(type+" | SPON SCALP BOSS @ "+Symbol()+","+IntegerToString(Period())+" | "+message); } else if(type == "order") { } else if(type == "modify") { } else if(type == "indicator") { if(Audible_Alerts) Alert(type+" | SPON SCALP BOSS @ "+Symbol()+","+IntegerToString(Period())+" | "+message); } } //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { SetIndexBuffer(0, Buffer1); PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE); PlotIndexSetInteger(0, PLOT_ARROW, 241); SetIndexBuffer(1, Buffer2); PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, EMPTY_VALUE); PlotIndexSetInteger(1, PLOT_ARROW, 242); //initialize myPoint myPoint = Point(); if(Digits() == 5 || Digits() == 3) { myPoint *= 10; } MA_handle = iMA(NULL, 0, 3, 0, MODE_SMA, PRICE_CLOSE); if(MA_handle < 0) { Print("The creation of iMA has failed: MA_handle=", INVALID_HANDLE); Print("Runtime error = ", GetLastError()); return(INIT_FAILED); } MA_handle2 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE); if(MA_handle2 < 0) { Print("The creation of iMA has failed: MA_handle2=", INVALID_HANDLE); Print("Runtime error = ", GetLastError()); return(INIT_FAILED); } return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ 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[]) { int limit = rates_total - prev_calculated; //--- counting from 0 to rates_total ArraySetAsSeries(Buffer1, true); ArraySetAsSeries(Buffer2, true); //--- initial zero if(prev_calculated < 1) { ArrayInitialize(Buffer1, 0); ArrayInitialize(Buffer2, 0); } else limit++; datetime TimeShift[]; datetime Time[]; if(BarsCalculated(MA_handle) <= 0) return(0); if(CopyBuffer(MA_handle, 0, 0, rates_total, MA) <= 0) return(rates_total); ArraySetAsSeries(MA, true); if(CopyTime(Symbol(), PERIOD_CURRENT, 0, rates_total, TimeShift) <= 0) return(rates_total); ArraySetAsSeries(TimeShift, true); if(BarsCalculated(MA_handle2) <= 0) return(0); if(CopyBuffer(MA_handle2, 0, 0, rates_total, MA2) <= 0) return(rates_total); ArraySetAsSeries(MA2, true); if(CopyOpen(Symbol(), 0, 0, rates_total, Open) <= 0) return(rates_total); ArraySetAsSeries(Open, true); if(CopyTime(Symbol(), Period(), 0, rates_total, Time) <= 0) return(rates_total); ArraySetAsSeries(Time, true); //--- main loop for(int i = limit-1; i >= 0; i--) { if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation int barshift_M5 = iBarShift(Symbol(), 0, TimeShift[i]); if(barshift_M5 < 0) continue; //Indicator Buffer 1 if(MA[barshift_M5] > MA2[barshift_M5] && MA[barshift_M5+1] < MA2[barshift_M5+1] //Moving Average crosses above Moving Average ) { Buffer1[i] = Open[barshift_M5]; //Set indicator value at Candlestick Open if(i == 1 && Time[1] != time_alert) myAlert("indicator", "Buy"); //Alert on next bar open time_alert = Time[1]; } else { Buffer1[i] = EMPTY_VALUE; } //Indicator Buffer 2 if(MA[barshift_M5] < MA2[barshift_M5] && MA[barshift_M5+1] > MA2[barshift_M5+1] //Moving Average crosses below Moving Average ) { Buffer2[i] = Open[barshift_M5]; //Set indicator value at Candlestick Open if(i == 1 && Time[1] != time_alert) myAlert("indicator", "Sell"); //Alert on next bar open time_alert = Time[1]; } else { Buffer2[i] = EMPTY_VALUE; } } return(rates_total); } //+------------------------------------------------------------------+
No need to use
(CopyOpen(Symbol(),0,0,rates_total,Open)
and
(CopyTime(Symbol(),Period(),0,rates_total,Time)
since the indicator ALREADY has an array
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[]) {
No need to use
and
since the indicator ALREADY has an array
Okay. Please how do I access the arrow objects in an EA?

- 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 an indicator that draws arrows on the chart as seen in the image below:
I tried searching for the arrow objects in ' Object List' but there were no objects there. I also checked ' Object List>List All' menu. I guess the way that the indicator is written has hid them from the chart. How can I expose these objects from the indicator to the chart?
Here are some relevant bits of my indicator: