MQL4 - automated forex trading   /  

Forum

iCustom issue - CenterOfGravity - how to print current values?

Back to topics list To post a new topic, please log in or register

avatar
3
zero1 2008.05.04 05:32 

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.


Attached files:
  CenterOfGravity.mq4 (5.41 KB)
article

Easy Way to Publish a Video at MQL4.Community

It is usually easier to show, than to explain. We offer a simple and free way to create a video clip using CamStudio for publishing it in MQL.community forums.


avatar
3
zero1 2008.05.04 12:01 

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]);

avatar
3
zero1 2008.05.04 15:32 
zero1 wrote:

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.






avatar
4
janebush08 2008.08.13 11:32 

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



crm software development


avatar
17
hansjlachmann 2009.10.07 00:45 

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

Attached files:
  CenterOfGravityScript.mq4 (3.81 KB)
Back to topics list  

To add comments, please log in or register