MQL5 Convert OnCalculate to OnTick
MQL5 Convert OnCalculate to OnTick
Loading saved threads...
lancegoh · External communityPost link
External question — Stack Overflow Stack Exchange
Author: lancegoh
Original post: https://stackoverflow.com/questions/76896039
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I am trying to convert an indicator to EA.
The Indicator have the following parameters and I like to spin it into EA.
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &Time[],
const double &open[],
const double &High[],
const double &Low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
Can someone help me what is the equal of rates_total, prev_calculated?
Quote
Report
Dale Woods · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: Dale Woods
Original post: https://stackoverflow.com/a/76962188
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Inside an EA those values don't exist. They are internal variables for Metatrader to track how many bars have been calculated on the chart in the indicator program environment.
For an EA you need to re-create this logic and track the bars on the chart yourself.
rates_total
= How may bars are available on the chart.
prev_calculated
= How many bars have you calculated with your program.
For the rest of the data you can get from MqlRates structure
https://www.mql5.com/en/docs/constants/structures/mqlrates
https://www.mql5.com/en/docs/series/copyrates
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: lancegoh Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/questions/76896039 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I am trying to convert an indicator to EA. The Indicator have the following parameters and I like to spin it into EA. int OnCalculate(const int rates_total, const int prev_calculated, const datetime &Time[], const double &open[], const double &High[], const double &Low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) Can someone help me what is the equal of rates_total, prev_calculated?
Checking account access…