MQL4 - automated forex trading   /  

Forum

Passing value to EA from custom indicator

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

avatar
30
dwt1020 2008.01.05 01:31 

I want to pass the value a variable from a custom indicator to an EA. Since the EA doesn't use the external buffer I think I an use it to get the data. Is this right? it's going to be a simlpe int value of 1 or 0. Or are these only used to paint item on the chart. If this is not possible can I have EA search the chart for a wingding to see if it's there or not? If so, would I have to know Exactly where to find it ?

I know you can put the indicator code inside the each, but the custom indicator calls another custom indicator, too much for my little brain...Is there another way to do this?

Can this be done?

thanks in advance...

d

article

Testing Features and Limits in MetaTrader 4

This article allows to find out more about features and limits of Strategy Tester in MetaTrader 4.


avatar
2462
phy 2008.01.05 04:28 

To pass numerical values between indicator and EA you can use GlobalVariables

http://docs.mql4.com/globals

Indicator would use GlobalVariableSet(), and EA would use GlobalVariableGet().

You can find Objects on a chart by name or by a property of the object.

for(i = ObjectsTotal()-1; i >= 0; i--){

string name = ObjectName(i);

... here are more decisions, depending on what you are trying to find...

... like if(ObjectType(name) == ... )

if(ObjectGet(name, OBJPROP_COLOR) == ... )

... and so on until you find or don't find what you are looking for


avatar
30
dwt1020 2008.01.05 04:39 
phy wrote:

To pass numerical values between indicator and EA you can use GlobalVariables

http://docs.mql4.com/globals

Indicator would use GlobalVariableSet(), and EA would use GlobalVariableGet().

You can find Objects on a chart by name or by a property of the object.

for(i = ObjectsTotal()-1; i >= 0; i--){

string name = ObjectName(i);

... here are more decisions, depending on what you are trying to find...

... like if(ObjectType(name) == ... )

if(ObjectGet(name, OBJPROP_COLOR) == ... )

... and so on until you find or don't find what you are looking for

Phy

thanks so much.... I have never used GlobalVariables and FORGOT THEY EXIST. . I amaze myself sometimes with my stupidity..LOL

thanks again

David

avatar
18
opti 2008.08.11 21:51 
phy wrote >>

To pass numerical values between indicator and EA you can use GlobalVariables

http://docs.mql4.com/globals

Indicator would use GlobalVariableSet(), and EA would use GlobalVariableGet().

You can find Objects on a chart by name or by a property of the object.

for(i = ObjectsTotal()-1; i >= 0; i--){

string name = ObjectName(i);

... here are more decisions, depending on what you are trying to find...

... like if(ObjectType(name) == ... )

if(ObjectGet(name, OBJPROP_COLOR) == ... )

... and so on until you find or don't find what you are looking for

Is it better to pass GlobalVariables from an Indicator to an EA or should the EA include the Indicator - calling the Indicator via iCustom() requires different parameters to be passed if the Indicator output consists of more than one value. Is that right?

Back to topics list  

To add comments, please log in or register