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:
//--- indicator settings
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_plots 6
#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"
#property indicator_type3 DRAW_ARROW
#property indicator_width3 5
#property indicator_color3 0xFFAA00
#property indicator_label3 "Buy"
#property indicator_type4 DRAW_ARROW
#property indicator_width4 5
#property indicator_color4 0x0000FF
#property indicator_label4 "Sell"
#property indicator_type5 DRAW_ARROW
#property indicator_width5 5
#property indicator_color5 0x00FFFB
#property indicator_label5 "CLOSE BUY"
#property indicator_type6 DRAW_ARROW
#property indicator_width6 5
#property indicator_color6 0x00FFFB
#property indicator_label6 "CLOSE SELL"
//--- indicator buffers
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];
double Buffer5[];
double Buffer6[];
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[];
int MACD_handle;
double MACD_Signal[];
int MA_handle3;
double MA3[];
double Close[];
int MA_handle4;
double MA4[];
int MA_handle5;
double MA5[];
int MA_handle6;
double MA6[];
double Open[];
.
.
.
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);
SetIndexBuffer(2, Buffer3);
PlotIndexSetDouble(2, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(2, PLOT_ARROW, 241);
SetIndexBuffer(3, Buffer4);
PlotIndexSetDouble(3, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(3, PLOT_ARROW, 242);
SetIndexBuffer(4, Buffer5);
PlotIndexSetDouble(4, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(4, PLOT_ARROW, 251);
SetIndexBuffer(5, Buffer6);
PlotIndexSetDouble(5, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetInteger(5, PLOT_ARROW, 251);
//initialize myPoint
myPoint = Point();
if(Digits() == 5 || Digits() == 3)
{
myPoint *= 10;
}
MA_handle = iMA(NULL, PERIOD_CURRENT, 1, 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);
}
.
.
.