Errors, bugs, questions - page 1132

 
A100:

No error when trying to change a pointer declared as const

Is it allowed to declare a constructor in a private section? Doesn't the compiler get an error?
 

So, the esteemed developers have responded to the application:

Support Team2014.04.16 15:58

We will make a stop flag, but it doesn't make much sense to use it in indicators. Indicators are not intended to perform super heavy or looped calculations in OnCalculate, because unlike Expert Advisors and scripts, they are not performed in separate threads. It means that by looping the indicator thread you stop forming the history (synchronization, adding ticks, etc.).
Support Team 2014.04.16 15:59
Status:OpenCompleted
 
Fleder:
Is it allowed to declare a constructor in a private section? The compiler doesn't complain?

You can, because this in itself is not controversial, and any restriction must be justified. Such an object can be created inside the class itself, and a pointer to such an object can be created outside the class

 
A100:

You can, because this in itself is not controversial, and any restriction must be justified. Such an object can be created inside the class itself, and a pointer to such an object can be created outside the class

If you can, why does the compiler say you can't:

 
mql5:
Now it is obligatory to place static members.

Thank you. However, it's not clear where they should be placed... My first attempts to push them into the root, before the function or directly next to the classes were unsuccessful - the error type just changed to redefinition. But all right, I'll try again, maybe I'll find a good place.


Fleder:Better yet, try to avoid using them.

Well, tell me too... How else to store all that information, which needs to be calculated once in X (somewhere a minute, somewhere a whole week), and use each tick in several classes? Or do you think it's better to start re-pairing different arrays with news, resistance levels and calculate statistics for the last 10000 candlesticks every tick? :) And in some places several times a tick, separately for each object of class? Then, I suspect, a run in the tester for a year and a half will take not an hour, as it is now, but the whole year and a half :)
 
Lone_Irbis:

Thank you. However, it's not clear where they should be placed... My first attempts to push them into the root, before the function or directly next to the classes were unsuccessful - the error type just changed to redefinition. But okay, I'll try again, maybe I'll find the right place.


Well, tell me, too. How else can I store all that information which must be calculated once in X (sometimes for a minute, sometimes for a whole week) and use each tick in several classes? Or do you think it's better to start fresh every tick to parse arrays with news, resistance levels and calculate statistics for the last 10000 candlesticks? :) And in some places several times a tick, separately for each object of class? Then I suspect that run in the tester for a year and a half will take not one hour, as it is now, but the whole year and a half :)
And it's better not to use a tester either.
 
Fleder:

If you can, why does the compiler say you can't?

It doesn't tell me

class B {
        B() {}
};
void OnStart()
{
        B *b;
}
Again: Such an object can be created inside the class itself, but a pointer to such an object can also be created outside the class
 

I don't understand how to scan servers when connecting? Previously, I entered the name of the server and the list popped up, I added the right ones (picture 2, there are added servers about a fortnight ago) In picture one is no longer scanning the right servers, I can not add. What is no longer possible or how do you do it yourself?


 
Fleder:
And it's better not to use a tester either.

Yeah, and forex is best not used at all either. Or the computer, for that matter :) It's not good for you.

Anyway, there's already a fix. It is not very nice, but it works. The fix is called "To hell with your OOP". %) The errors were eliminated by sawing all the static variables from the classes, removing prefix static from them and stacking them neatly next to each other.

In general, I do not know why developers did not like static variables and why they had to remove automatic variable initialization feature, but if I have to, I have to. We'll have to use workarounds...

 
Lone_Irbis:

Yeah, and forex is best not used at all either. Or the computer, for that matter :) It's not healthy at all.

Anyway, there's already a fix. It is not very nice, but it works. The fix is called "To hell with your OOP". %) The errors were eliminated by sawing all the static variables from the classes, removing prefix static from them and stacking them neatly next to each other.

In general, I do not know why developers did not like static variables and why they had to remove automatic variable initialization feature, but if I have to, I have to. We'll have to use workarounds...

Simply automatic initialization was replaced by explicit placement.

And if you strive for perfection, then:

1. the best way to trade is not to trade.

2. The best way to live life is not to be born.

Reason: