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
Now it is not strange why there is not enough Volchanskiy here, tough guy Insider preview or whatever he uses))
I downloaded win 10home from the off site 3 months ago, did not even have time to configure the basic settings, the startup Options icon does not open, yes ***********
Here is an example:
Tried to fully apply your example to my task, but again the same rake - I want to end up with the "record required" flag when creating a new descendant from a base class:
2019.09.14 16:07:26.856 Builder_v1.00 (EURUSD,H1) CStrategy::CStrategy(int)save = 0
2019.09.14 16:07:26.856 Builder_v1.00 (EURUSD,H1) CStrategy::CStrategy(int)save = 0
2019.09.14 16:07:26.856 Builder_v1.00 (EURUSD,H1) 4
2019.09.14 16:07:26.856 Builder_v1.00 (EURUSD,H1) 1
for now everything that has worked out:
1. not declaring interfaces was not a problem at all
2. I generated a lot of setters and getters but was unable to get away from static variables
I tried to rewrite the code again:
the result is the same as in the first version, the only thing is that I got away from interfaces
What's the goal, what do you want to get?
everything works, but the goal is to gain knowledge ))))
how i did it:
- there is a base class in which all calculations and it stores TC settings, from it we inherit descendants that work by their TC
- I think it is reasonable to save the file into one file by passing the handle of the open file to all descendants; in this case, the save() method appears in the base class again
- saving should be performed when an event/flag occurs - you don't know which descendant initiates it and when, but it is faster to save dozens of structures to a new file than to figure it out
- why not make one class and an array of settings? - I have to declare one or two methods as virtual and add them to each TS.
- the problem: i'm trying to get away from static variables in the hope that there's a jedi OOP trick i don't know
SZY: const modifiers are a good thing, I don't regret the time spent - useful, thanks again for the discussion!
If you have to write data from all objects of this class into one file, which is opened once, then you can't do it without a static variable. And why get rid of it, if it best suits the task? Of course, you can declare a global variable too.
What if every object would open, write and close a file? Then it would be sufficient to have a file name in every object... But in this case, too, it's better to use a static variable, because the value of the variable is always the same everywhere.
Or I don't understand anything)
If you have to write data from all objects of this class into one file, which is opened once, then you can't do it without a static variable. And why get rid of it, if it best suits the task? Of course, you can declare a global variable too.
What if every object would open, write and close a file? Then it would be sufficient to have a file name in every object... But in this case, too, it's better to use a static variable, because the value of the variable is always the same everywhere.
Or maybe I've got it wrong)
In the file, which is opened once, we write data in it and immediately close, so as not to lose data if the terminal hangs up, recording from once in a minute to once an hour - there's no sense to keep the file open for so long
let's do it in code, that's how it is now:
Or maybe I didn't understand anything.
I don't think I understood anything, I read the article diagonally last month, came back to it again this month, but need to test to see feasibility
Hubr:Singleton or static class?
- Problem: I'm trying to get away from the static variable in the hope that there's a Jedi OOP trick I don't know
Why is this a problem? You don't need to get away from a static variable if you need it.
I still don't understand what the write need flag depends on.
In my example it is set if there have been changes.
How do you want it set?
Why is this a problem? You don't have to walk away from a static variable if you need one.
then the problem is solved! - That's how it was originally done.
ZS: already started experimenting with static structure... I see only problems with initialization, then with code readability, I tried variants flag.saveRequired, then flagsave.Required, then I got into overload operator =, anyway, nonsense all this. It is much easier and readable code in the end if you make it via private static variable and add setter and getter to it, but as they say: we are not looking for easy ways.... all the best to the authors of obscure videos...
Now it is not strange why there is not enough Volchanskiy here, tough guy Insider preview or whatever he uses))
I downloaded win 10home from the off site 3 months ago, did not even have time to configure the basic settings, the startup Options icon does not open, yes ***********
Just busy and forum is time consuming, I don't recommend to installInsider preview, now Vinda installs new build once a week. Better to download the stable build from MS site. It's my childish curiositystill playing in one place :)