What does the keyword static do, and should you be using it?
Thanks to you for saying this ive now reallised the following does what i need
int start() { int count; for(int i=Bars-1; i>=0; i--) { double ma = iMA(_Symbol,_Period,200,0,MODE_SMA,PRICE_CLOSE,i); if(Open[i]<ma && Close[i]>ma) count++; Print(" i = ",i," count = ",count); } return(0); }
By doing the count outside the block and taking static away it now counts the previous signals once and each new signal.
Thanks for that reminder.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
As seen the following code at 00:00 it cycles down 1000 - 0 and increments ++ on each signal found.
The problem is on next bar say 00:15 it cycles 1001-0 only this time increments each signal found again? when i need it to only increment new signals as they occur not the repeat unwanted counts.
Not sure what to do?