iCustom() Question

To add comments, please log in or register
The Xlearner
212
The Xlearner  

Hello everybody

I need some help on how can I use a the iCustom() function to detect the color of the circles that the indicator draw’s (Red or Green ?) 

 

 

,I try to look to the Data Window to know the indicator buffers  , but there is nothing .

(I have the compiled file) 

 

Keith Watford
Moderator
19029
Keith Watford  

I doubt that you could get the colour using iCustom unless the colours relate to a buffer value

Probably, the circles are objects, so you could use ObjectGet to retrieve the colour property. 

The Xlearner
212
The Xlearner  
GumRai:

I doubt that you could get the colour using iCustom unless the colours relate to a buffer value

Probably, the circles are objects, so you could use ObjectGet to retrieve the colour property. 

Thanks 
Yes , I think that also , because I try to change the position of circle from the chart and they changed , but they return to there position when a new tick came . 
Can you explain to me or give me links on how can I use ObjectGet to do this trick ?
Syed Naufal Gaddafi
1724
Syed Naufal Gaddafi  
If you don't have the source file for the indicator, no point.
Keith Watford
Moderator
19029
Keith Watford  
xlearner:
Thanks 
Yes , I think that also , because I try to change the position of circle from the chart and they changed , but they return to there position when a new tick came . 
Can you explain to me or give me links on how can I use ObjectGet to do this trick ?
If you look at the MQL4 reference for ObjectGet(), it actually gives an example of how to retrieve the colour
Keith Watford
Moderator
19029
Keith Watford  
deysmacro:
If you don't have the source file for the indicator, no point.
You don't need the source code if the indicator draws objects, you just need the name of the object and that is easy enough to get with Ctrl B
The Xlearner
212
The Xlearner  
GumRai:
You don't need the source code if the indicator draws objects, you just need the name of the object and that is easy enough to get with Ctrl B

Thanks for your fast replies GumRai 
if I want to use this indicator objects values in EA , how can I do it ?

Or how I can call this indicator to use the objects function ?
Keith Watford
Moderator
19029
Keith Watford  
xlearner:

if I want to use this indicator objects values in EA , how can I do it ?

Already answered
GumRai:
If you look at the MQL4 reference for ObjectGet(), it actually gives an example of how to retrieve the colour
Keith Watford
Moderator
19029
Keith Watford  
xlearner:
Or how I can call this indicator to use the objects function ?
 You can't, just get the values from the object
The Xlearner
212
The Xlearner  
GumRai:
 You can't, just get the values from the object
Is this right ?
static int Trend=1245;
string clr;
clr=ColorToString( ObjectGet( "D1B", OBJPROP_COLOR ),True); // "D1B" is the name of the object 
      
      if (clr=="clrLimeGreen")
      {
            Trend=0; // Up 
            
            Print("The color is ", clr ," and the Trend = ",Trend);

      }
         if(clr=="clrRed")
         {

            Trend=1; // Down
            
            Print("The color is ", clr  ," and the Trend = ",Trend);
         }
I try this code but it run's just one time when I Run the strategy tester 
Keith Watford
Moderator
19029
Keith Watford  

That looks good to me. You are definitely on the right track.

If using in the strategy tester, you will have to attach the indicator to the tester chart (ie attach the indicator to a chart and save template as tester.tpl

For your EA to detect objects in Strategy Tester, it must be run in visual mode .

To reduce the amount of Prints you may only want to print when the "trend" changes 

 if (clr=="clrLimeGreen" && Trend!=0)
      {
            Trend=0; // Up 
            
            Print("The color is ", clr ," and the Trend = ",Trend);

      }

 

 or if watching in visual mode, consider using Comment() instead of Print() 

12
To add comments, please log in or register