How to code? - page 148

 

Count Bars Since Order Opened

Anyone write a routine to determine the number of bars since an order opened?

 

Problem in NormalizeDouble

I need 5 digit after decimal from price quote, it will display when using DoubleToStr function. I want to store a vlue get from object and use it for further calcullation i.e "price2"

could anyone please help me to solve this problem

Files:
objget.mq4  2 kb
 

Need help with my indicator.

My indicator does not work properly, the indicator works fine on screen but when I try to use in an EA and let it Alert(iCustom(....)); it gives an enormous value.

TSD = iCustom(NULL,0,"Pascal_Indicator1",0,0);

Alert(TSD); // gives 214723948223...

The indicator 's code is :

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars <= 0) return(0);

int i = counted_bars;

while(i >= 0){

if(i > 0){

ExtMapBuffer1 = calculateData();

}

i--;

}

return(0);

}

I must be doing something dramatically wrong

Pascal.

 

To Pascal

Do you have the Parameters set for your indicator?

 
Roger09:
To Pascal Do you have the Parameters set for your indicator?

It does not have any parameters and as I said it looks fine on screen only the function returns this huge number.

 
paypascal:
It does not have any parameters and as I said it looks fine on screen only the function returns this huge number.

If you send me your code, I'll test it and can help you.

 
paypascal:
My indicator does not work properly, the indicator works fine on screen but when I try to use in an EA and let it Alert(iCustom(....)); it gives an enormous value.

TSD = iCustom(NULL,0,"Pascal_Indicator1",0,0);

Alert(TSD); // gives 214723948223...

The indicator 's code is :

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars <= 0) return(0);

int i = counted_bars;

while(i >= 0){

if(i > 0){

ExtMapBuffer1 = calculateData();

}

i--;

}

return(0);

}

I must be doing something dramatically wrong

Pascal.

iCustom() try to get the bar[0] value, but your indic does not calcul it " if(i>0) ", so the returned value is EMPTY_VALUE = 214....

 
 

added alert to nonlagZigZag indicator

Thank you tk748, for providing a possible work-around for my request. In turn, I have attached my attempt to provide your requested alerts on the NonLagZigZag indi. Although I can see that the alerts are working, please note that because today is Saturday, I have not tested to see if alerts occure at a useful time. I left a few comments in the code to show why I believe the alerts are in the correct location. I think you will like to try this out as soon as the markets are open.

Best regards, kevin07

 

nonlagzigzag signal

Thank you kevin07. I will try the nonlagzigzag signal when the market opens later today.

Regards, tom

Reason: