- how to set an array of built-in structures as function's return type?
- How to debug with drawing on chart?
- Calculate technical indicator on custom array
Place the cursor on OnCalculaate() and press F1 - it'll tell you what you need.
Beside that here is the list of all function with short descriptions - for a keyword search.
- www.mql5.com
When in doubt, always remember to reference the documentation. All of the following information is quoted from there.
OnCalculate returns ...
Return Value
int type value to be passed as the prev_calculated parameter during the next function call.
As for the price[] data, you will not be able to know what it is.
If you prefer to have access to the full OHLC data instead of a user selected price data, then use the other form of OnCalculate. There are two forms ...
OnCalculate
The function is called in the indicators when the Calculate event occurs for processing price data changes. There are two function types. Only one of them can be used within a single indicator.
Calculation based on data array
int OnCalculate( const int rates_total, // price[] array size const int prev_calculated, // number of handled bars at the previous call const int begin, // index number in the price[] array meaningful data starts from const double& price[] // array of values for calculation ); |
Calculations based on the current timeframe timeseries
int OnCalculate( const int rates_total, // size of input time series const int prev_calculated, // number of handled bars at the previous call const datetime& time{}, // Time array const double& open[], // Open array const double& high[], // High array const double& low[], // Low array const double& close[], // Close array const long& tick_volume[], // Tick Volume array const long& volume[], // Real Volume array const int& spread[] // Spread array ); |
When in doubt, always remember to reference the documentation. All of the following information is quoted from there.
OnCalculate returns ...
As for the price[] data, you will not be able to know what it is.
If you prefer to have access to the full OHLC data instead of a user selected price data, then use the other form of OnCalculate. There are two forms ...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use