simple iCustom question

athan
249

Hi,

i m trying to call iCustom of a Pivot Points custom indicator that i ve build. 

 This PP cusom indicator got Daily, Weekly and Monthy Pivot Lines that i m drawing on the chart using objects so i do not need to use any buffers. I use only some global double series of variables like Weekly_P, Weekly_RS1 etc. My question is do i need to use a Buffer and setindexbuffer in order to call my custom PP indicator from an EA or another script?

Thanks 

Simon Gniadkowski
17410
athanfx:

Hi,

i m trying to call iCustom of a Pivot Points custom indicator that i ve build. 

 This PP cusom indicator got Daily, Weekly and Monthy Pivot Lines that i m drawing on the chart using objects so i do not need to use any buffers. I use only some global double series of variables like Weekly_P, Weekly_RS1 etc. My question is do i need to use a Buffer and setindexbuffer in order to call my custom PP indicator from an EA or another script?

Read some of the recent posts on this Forum . . .

https://www.mql5.com/en/forum/143606 

Simon Gniadkowski
17410
athanfx:

Hi,

i m trying to call iCustom of a Pivot Points custom indicator that i ve build. 

 This PP cusom indicator got Daily, Weekly and Monthy Pivot Lines that i m drawing on the chart using objects so i do not need to use any buffers. I use only some global double series of variables like Weekly_P, Weekly_RS1 etc. My question is do i need to use a Buffer and setindexbuffer in order to call my custom PP indicator from an EA or another script?


Why not add your Indicator code into your EA ?
athan
249
athan  
RaptorUK:
Why not add your Indicator code into your EA ?


well i m trying to gain time thats why.

 the problem with GetObject function, although its working, is that in the following while loop were i m scanning the bars i cannot specify for specific bar to return the value of that object

/********************************* MAIN WHILE LOOP ****************************                            
    while ( (i<=candles) )
    {
         
         param=ObjectGet("PivotLine",OBJPROP_PRICE1);
         
         log("param:"+param);

      i++;
     }

  the above will return  the same result for all the i bars. And thats normal. With iCustom you can specify the Bar of the calling indicator.

Any way to overcome this?  

Simon Gniadkowski
17410
athanfx:


well i m trying to gain time thats why.

 the problem with GetObject function, although its working, is that in the following while loop were i m scanning the bars i cannot specify for specific bar to return the value of that object

  the above will return  the same result for all the i bars. And thats normal. With iCustom you can specify the Bar of the calling indicator.

Any way to overcome this?  

How many Pivot Lines do you have ?  are they Horizontal Lines or Trend Lines ?  
athan
249
athan  
RaptorUK:
How many Pivot Lines do you have ?  are they Horizontal Lines or Trend Lines ?  
Simon Gniadkowski
17410
athanfx:
21 Horizontal Lines... 
Well they go all the way across the chart from bar 0 to bar Bars  . . .  how do you know which one you want ?
William Roeder
25836
William Roeder  
param=ObjectGet("PivotLine",OBJPROP_PRICE1);
That is ONE line. You need to get all HLINES.
athan
249
athan  
RaptorUK:
Well they go all the way across the chart from bar 0 to bar Bars  . . .  how do you know which one you want ?


i know cause of the while i loop... the var i gives me the bar that i need to get.

 

WHRoeder:
That is ONE line. You need to get all HLINES.

 no i do not need the other HLINES. My main problem is that i get the price of the PivotLine object for a very specific time/bar and i m not able to scan through the chart for every single bar to get that object price. In the ObjectGet function there is no shift parameter. That is what i m looking for.

Simon Gniadkowski
17410
athanfx:


i know cause of the while i loop... the var i gives me the bar that i need to get.

I meant how do you know which  Horizontal Line  you need ?  they all go across all bars.
William Roeder
25836
William Roeder  
athanfx: My main problem is that i get the price of the PivotLine object for a very specific time/bar and .. ObjectGet function there is no shift parameter.

Translation: I am looking for the hight a building last Tuesday and there is no function that takes a date. Of course there is no function that takes a date because the hight last Tuesday is the same hight today.

You say want the price of a line for a specific time/bar. It is the same price for every bar. It is a horizontal line.

But if you insist

double HLineGet(string h, int shift=0){ return( ObjectGet(h,OBJPROP_PRICE1) ); }