iCustom issue - CenterOfGravity - how to print current values?

 

Hello Guys,


pls kindly see attached screen - I would like to see in a Comment() the last (current) values of the gravity lines.

Tried different ways but can not get to the buffer data - kindly askig for your help!

Indicator's mq4 is attached.

Files:
 

Pls disregard - I have investigated in documentation already and the proper code printing current values on the screen seems to be:


Comment("sqh: ", sqh[0], "\n",
            "sql: ", sql[0], "\n",
            "stdh: ", stdh[0], "\n",
            "stdl: ", stdl[0]);
 
zero1:

Pls disregard - I have investigated in documentation already and the proper code printing current values on the screen seems to be:


Comment("sqh: ", sqh[0], "\n",
            "sql: ", sql[0], "\n",
            "stdh: ", stdh[0], "\n",
            "stdl: ", stdl[0]);


Now I have stuck with iCustom() function.

When I pull COG (Center Of Gravity) values on the terminal right from the indicator using code above, all is working well.


But when I try to call these values from an EA using the iCustom() - I see nothing.

Since all buffers are defined in COG:


int init()
{
IndicatorShortName("Center of Gravity#2");
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, fx);
SetIndexBuffer(1, sqh);
SetIndexBuffer(2, sql);
SetIndexBuffer(3, stdh);
SetIndexBuffer(4, stdl);
p = MathRound(bars_back);
nn = m + 1;
ObjectCreate("pr" + sName, 22, 0, Time[p], fx[p]);
ObjectSet("pr" + sName, 14, 159);
return(0);
}


I thought, simple calling from EA for the COG's buffer number should work:


Comment("sqh: ", iCustom(Symbol(), 0, "Center of Gravity#2", 1, 0), "\n",
"sql: ", iCustom(Symbol(), 0, "Center of Gravity#2", 2, 0), "\n",
"stdh: ", iCustom(Symbol(), 0, "Center of Gravity#2", 3, 0), "\n",
"stdl: ", iCustom(Symbol(), 0, "Center of Gravity#2", 4, 0));


but it does not for me - anyone to show my error?

Many thanks.

 

I don't get that... will need to study...



crm software development

 

Hi, here is a script with a function that calculates the 5 arrays from this indicator. Can be implemented in any Expert Advisor

kind regards

Hans

Reason: