Thank you i fixed it
- Indicators: Stochastic Divergence
- Coding help
- It is my first to use file in MQL4, help!
currentPrice=iClose(NULL,PERIOD_CURRENT,i); prevPrice=iClose(NULL,PERIOD_CURRENT,i+1);
Aren't these unnecessary?
if(i<limit-bars_back)
The first calculation will be executed, but the second and subsequent calculations will not be executed because "limit-bars_back" will be negative.
In other words, the total is always zero.
if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars;
If the starting position of the calculation is not taken into account, an error will occur.
![The checks a trading robot must pass before publication in the Market The checks a trading robot must pass before publication in the Market](https://c.mql5.com/36/43/the-checks-a-trading-robot-must__2.jpg)
The checks a trading robot must pass before publication in the Market
- www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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