Download MetaTrader 5

Buffers possible in an EA?

To add comments, please log in or register
mar
1146
mar  

Hi forum,

I have an indicator which basically marks a high when the high to the left and the high to the right are lower. Similar to the fractal indicator. I use a buffer to place a dot on the bar with the highest high.

Now I would like to implement this feature into an EA. But I can't use normal buffers in an EA. So I think I need to use an object. But using a text or label object is not possible because I can't place it directly above a candle and it is way too uncomfortable to place it with the correct x/y-values. 

Does anybody have an idea how to solve this problem? 

Keith Watford
Moderator
9641
Keith Watford  

If you need a visual aid, just use an arrow.

An EA does not need to have anything placed on the chart to make its calculations. 

mar
1146
mar  
Yes, it's only a visual aid for me. But how can I place an arrow above or below a bar like I do with buffers? An arrow can only be a text or label object and this can only placed by using x- and y-pixel values. Or am I wrong?
Keith Watford
Moderator
9641
Keith Watford  

You are wrong

OBJ_TEXT and OBJ_ARROW can be placed by Time and Price

mar
1146
mar  

GumRai, every time I think I know everything, you show me something new... :D

 Thank you! 

mar
1146
mar  

It's not 100% working like it should do but maybe you have an idea how to correct this? I made a small script:

void OnStart()
  {
//---
   ObjectCreate(0, "OBJ", OBJ_TEXT, 0, Time[1], High[1]);
   ObjectSetText("OBJ", CharToStr(159), 8, "Wingdings", clrWhite);
  }

 

But the dot is not placed right above the bar, it is a bit lower within the bar. I also tried High[1]+10*Point but if I change timeframes or chart scale, the dot is located at a different place.

whroeder1
14781
whroeder1  
mar
1146
mar  
Awesome, works exactly like I want. Thank you!
To add comments, please log in or register