I 'm trying to figure out how to pass struct MqlRates members to a function as arrays but the compiler refuses stubbornly coding like open, rt.open and rt[].open, maybe some sort of a pointer?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hello,
I 'm trying to figure out how to pass struct MqlRates members to a function as arrays but the compiler refuses stubbornly coding like open, rt.open and rt[].open, maybe some sort of a pointer?
here is the relevant part of the code.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
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 &TickVolume[],
const long &Volume[],
const int &Spread[])
This compiles:
reBuild(rates_total, prev_calculated, open, high, Low, close, time);
----
MqlRates rt[];
if(CopyRates(NULL,InpTimeFrame,0,InpTimeBarsLimit,rt)!=InpTimeBarsLimit)
{Alert("Error CopyRates ",GetLastError());ExpertRemove();}
else
This does not compile:
reBuild(rates_total, prev_calculated, rt.open, rt.high, rt.Low, rt.close, rt.time);
----
void reBuild(const int rates_total, const int prev_calculated, const double &Open[], const double &High[], const double &Low[], const double &Close[], const datetime &Time[])
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Is there a way to pass MqlRates members to a function?