Download MetaTrader 5

Aligning of OBJ_ARROW_LEFT_PRICE possible?

To add comments, please log in or register
PomeGranate 2015.04.29 11:40 

Hello World! ;)

I wish to let my Pivot Point (PP) indicator display a preview of tomorrows' PPs.

Neatest label is in my view provided by OBJ_ARROW_LEFT_PRICE. The Problem is, that object type is anchored by time (and price). I wonder whether there is a way to align the display to the right corner?

Or do I have to use another object type? Or even create one, derived from OBJ_ARROW_LEFT_PRICE (for which my programming skills are far too small (yet)).

Please don't kill me for bad programming or stupid questions, I'm a beginner! Thank you. :)

Here is the relevant part of the code, which I actually use, but it paints the labels too close to the current bar:

void DrawPreview(string arrowlabel, int shift, double PriceToDraw, color ColorToDraw)
   // Time
   datetime TimeToDraw = Time[shift];
   // Label
   string label = arrowlabel;
   if(ObjectFind(label) != -1) ObjectDelete(label);
   ObjectSetInteger(0,label, OBJPROP_ANCHOR, ANCHOR_RIGHT); //doesn't work, guess it's due to object type?!?
   ObjectSetInteger(0, label, OBJPROP_COLOR, ColorToDraw);

   DrawPreview("PRICE LABEL", 0, someprice, someclr);
whroeder1 2015.04.29 12:29  
Try anchoring it to a future price. Or use an Hline
PomeGranate 2015.04.29 13:20  
Try anchoring it to a future price. Or use an Hline

Thanks for your comment.

I had the same idea, but how do I code the price at Point in the future? Don't know whether it is useful to spend resources following this idea, as  it seems to me that in MT4 the future is unchartered territory?!

The latter idea I had also considered, but the hline would span across the whole chart, which is unfavourable. OBJ_HLINE can't be 'cut off' as far as I know, can it?

Meanwhile I'm asking myself, whether I should switch to OBJ_LABEL type, but there arises the next problem: this type is anchored by x,y-coordinates. But how would I determine the y-coordinate of the price I want to stick it to?

I really need a break now, will clean up kitchen, then resume solving this problem. Elaboration/new ideas are welcome! :)

whroeder1 2015.04.29 16:01  
PomeGranate: but how do I code the price at Point in the future?
datetime time0 = Time[0],
         future= time0 + PeriodSeconds();
PomeGranate 2015.04.29 16:51  

Cool, thank you very much - it works!

In the meantime I added weekly Pivot Points to the indicator, as an option... and promptly face a new (old) problem! Who really needs sunday bars? ;)

But that doesn't fit in this thread anymore, I'll perhaps open another one for general discussion of this indicators' programming.

This issue is solved, thanks again.

To add comments, please log in or register