hi;
i want to define a function such that : count no. of bar those above zero line after last cross zero line.
i wrote this:
can you please tell me what is the problem?
thank you.
Get rid of the globally declared count_bar variable . . . you don't need it.
Do this . . .
int IsIndicator_domain_above() // <--- edited { int count_bar; // <--- added for(int j=0; j<TOTAL_BAR; j++) { if(Ext_AO_Buffer[j]>=0.0&&Ext_AO_Buffer[j+1]<=0.0) { count_bar = j + 1; // <--- edited break; // <--- edited } } return(count_bar); }
then call the function like this . . .
; . . Comment("" , "\ncount_bar=", IsIndicator_domain_above() )
Get rid of the globally declared count_bar variable . . . you don't need it.
Do this . . .
then call the function like this . . .
thank you;
i see my mistake;
thank again.
can you please check about warning ?
with :
. int count_bar; . . //+------------------------------------------------------------------+ void OnInit() { . . } //+------------------------------------------------------------------+
there is no warning & problem solved.
thank you RaptorUK.
with :
there is no warning & problem solved.
thank you RaptorUK.
Nope, that is wrong.
I think this is the correct way to get rid of the warning . . .
int IsIndicator_domain_above() { int count_bar = 0; // <--- edited for(int j=0; j<TOTAL_BAR; j++) { if(Ext_AO_Buffer[j]>=0.0&&Ext_AO_Buffer[j+1]<=0.0) { count_bar = j + 1; break; } } return(count_bar); }
Nope, that is wrong.
I think this is the correct way to get rid of the warning . . .
yes.
you are right.
thank you.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi;
i want to define a function such that : count no. of bar those above zero line after last cross zero line.
i wrote this:
can you please tell me what is the problem?
thank you.