Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 717
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
Thank you. I'm having trouble calling a parent class method.
As far as I remember it is done via parent :: method
Does the method itself have a body in the parent?
Does the method itself in the parent have a body?
Yes, it does.
Here's the code, what am I doing wrong ?
//+------------------------------------------------------------------+
class A
{
public:
virtual int Test_A()
{
return 100;
}
};
//+------------------------------------------------------------------+
class B :public A
{
public:
virtual int Test_A()
{
return 200;
}
};
B b;
//+------------------------------------------------------------------+
void OnStart()
{
Comment (A::b.Test_A());
}
//+------------------------------------------------------------------+
Here's the code, what am I doing wrong ?
no, it won't work that way
by writing the test() body in the B class, you've closed the old Test() function and now when you declare an instance of the class and call the Test() method, it will always run B::Test(), but if you didn't write B::Test(), it would always run A::Test()
here's an example. experiment with it
Hmm, strange, no one replies.
I don't think anyone understands your post :)
Hi, how to make the EA open positions with a specified volume of single orders of both positions according to external variables, e.g.
The volume of a single order is 1.35 lots, the total volume of the open positions is 500 lots. The EA opens a buy order of 1.35 lots, and then opens a sell order of 1.35 lots,
and then repeats until 500 lots buy and 500 lots sell are opened, and since the number of lots is not a multiple of 1.35, the last order must be less than 1.35
Greetings.
I made a function that when an order reaches profit points "bezubitok", it modifies the order by moving it to the order opening level. It seems to work correctly, but during testing (and on all ticks) every 10-20th time it sends error 1 to the log.
No error, but the result is unknown
What is the reason for this and how do I defeat it?
Greetings.
I made a function that when an order reaches profit points "bezubitok", it modifies the order by moving it to the order opening level. It seems to work correctly, but during testing (and on all ticks) every 10-20th time error 1 is written to log.
What is the reason for this and how do I fix it?
Error 1 is no error, but the result is unknown. The point is that you are trying to modify the stop to the same price it is already at. Before modifying it, compare the price of the stop with the price at which you want to set it. If it is already at that price, there is nothing to modify.