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
Hello! How do I find a value in a two-dimensional array? You need to search in the first dimension. There seems to be no standard means. Thank you!
Hello! How do I find a value in a two-dimensional array? You need to search in the first dimension. There seems to be no standard means. Thank you!
I've started to study OOP.
I had a problem when writing a descendant of a base class, the compiler writes - "'ХХХХХХ' - wrong parameters count".
I searched for the reason for a long time, re-read articles and reference book,
but I found it - the base class has a constructor, it is one and parametric.
I've found a solution too - overloading of the constructor function with the default constructor,
but then I have to drag all the parameters of the parametric constructor of the base class to the descendant constructor for correct logic.
Are there any other ways?
Is there any way, when declaring a descendant class, to distribute to whom what? For example: these parameters to the constructor of the base class and these parameters so that the descendant doesn't get bored...
If a base class has a single parametric constructor, the descendant class cannot avoid calling it. However, the child class can have any number of parameters, including having no parameters at all. The main thing is that the constructor of the base class is called with all the parameters assigned to it. Example:
There was a discussion in the thread about
ENUM_POSITION_TYPE
two values. and what is returned if there are no open positions?
I use the PositionType() method from the standard library.
Ok, I got it, PositionSelect() returns false, and PositionType() returns the type of the last selected position.
it turns out that if there is no position opened, it always returns 0, i.e. as if a buy position is opened?
how do i get around this?
There was a discussion in the thread about
ENUM_POSITION_TYPE
two values. and what is returned if there are no open positions?
I use the PositionType() method from the standard library.
Ok, I got it, PositionSelect() returns false, and PositionType() returns the type of the last selected position.
it turns out that if there is no position opened, it always returns 0, i.e. as if a buy position is opened?
how do i get around this?
There are two variants ofOnCalculate function definition:
1)int OnCalculate (const int rates_total, // size of array price[]
const int prev_calculated, // processed bars at previous call
const int begin, // where significant data starts from
const double& price[] // array for calculation
);
2)int OnCalculate (const int rates_total, // size of input timeseries
const int prev_calculated, // bars processed at previous call
const datetime& time[], // Time
const double& open[], // Open
const double& high[], // High
const double& low[], // Low
const double& close[], // Close
const long& tick_volume[], // Tick Volume
const long& volume[], // Real Volume
const int& spread[] // Spread
);
call the function 1)OnCalculate(), prefill all its parameters - OnCalculate(rates_total,0,0,_price);
QUESTION: could you please fill in the parameters for the second call toOnCalculate() in this case?
There are two variants ofOnCalculate function definition:
1)int OnCalculate (const int rates_total, // size of array price[]
const int prev_calculated, // processed bars at previous call
const int begin, // where significant data starts from
const double& price[] // array for calculation
);
2)int OnCalculate (const int rates_total, // size of input timeseries
const int prev_calculated, // bars processed at previous call
const datetime& time[], // Time
const double& open[], // Open
const double& high[], // High
const double& low[], // Low
const double& close[], // Close
const long& tick_volume[], // Tick Volume
const long& volume[], // Real Volume
const int& spread[] // Spread
);
call the function 1)OnCalculate(), prefill all its parameters - OnCalculate(rates_total,0,0,_price);
QUESTION: could you please fill in the parameters for the second call toOnCalculate() in this case?
and nothing needs to be filled in the first or second case.
I need to call this function forcibly - how do I fill in the parameters in this case ?
You can't create one of your own.