Error. My EA can not read the value of the trend line of my custom indicator.

 

Hi Everyone

I am trying to get my EA to read the value of a line drawn by a custom indicator. The indicator has NO buffers, instead it uses Object Create to draw triangular lines. How can I get an EA to read the price value of these drawn graphical objects.

The usual coding for custom indicators, iCustom(...........) cannot read the value of the lines generated by the indicator.

I have tried the code...... double price=ObjectGetValueByShift("H4_S", 1); ... but it returns a Zero every time

Thanks heaps guys, you are awesome

Here is a bit of the indicator code, so you can see what is going on.

#property indicator_chart_window


extern color H4_R=Blue;
extern color H4_S=FireBrick;
#define RESISTANCE 1
#define SUPPORT 2

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()

       ObjectCreate(name, OBJ_TREND, 0, array[p2][0], array[p2][2], array[p1][0], array[p1][2]);
    
     else
       ObjectCreate(name, OBJ_TREND, 0, array[p2][2], array[p2][3], array[p1][0], array[p1][3]);
       
     ObjectSet(name, OBJPROP_COLOR, hue);
     ObjectSet(name, OBJPROP_RAY, true);
     ObjectSet(name, OBJPROP_BACK, true);
     ObjectSet(name, OBJPROP_WIDTH, thickness);
     ObjectSet(name, OBJPROP_STYLE, style);

many thanks

 

I am trying to get my EA to read the value of a line drawn by a custom indicator.

The indicator has NO buffers,

The usual coding for custom indicators, iCustom(...........) cannot read the value of the lines generated by the indicator.

As expected. custom reads from the buffers.

I have tried the code...... double price=ObjectGetValueByShift("H4_S", 1); ... but it returns a Zero every time

Since that doesn't work you might try ObjectGet on the endpoints and do your own calculation.

But I suggest you move the TL endpoint calculation into the EA and draw them there or have the indicator fill in its buffer with the proper values.

 
WHRoeder:

As expected. custom reads from the buffers.

Since that doesn't work you might try ObjectGet on the endpoints and do your own calculation.

But I suggest you move the TL endpoint calculation into the EA and draw them there or have the indicator fill in its buffer with the proper values.

the function of ObjectGet will work if your custom indication run in the same TF, you need to specify the object name, property correctly etc...

Reason: