When to stop OnInit()
-
When viewing the generated code, the OnInit() function always contains the code shown below.
What is the purpose of it? It seems the code stops the initializing process if the init reason is a change of symbol or change of timeframe.
Well that seems appropriate for most cases, but why the else statement? Now the init is stopped in any case, right?The problem: Lets say a project contains some graphical objects on the OnInit() tab, and some boolean constant input determines if those objects should be drawn or not.
If the user changes this boolean while the EA is running, the changes will not take effect because the OnInit() is stopped before those blocks are executed.I often delete that else statement manually to make those objects inputs work properly, but I'd rather have this code changed for good.
Example: https://fxdreema.com/shared/pd9JF900c

-
-
I probably put this code there when someone was having issues when changing the parameters of the EA, or changing the timeframe. I don't remember exactly.
I think the only two possible uninitialize reasons in
OnInit()are REASON_CHARTCHANGE or REASON_PARAMETERS, which means that the "else" statement is about REASON_PARAMETERS.It looks that I wanted to prevent re-execution of blocks in "on Init" when the user changes the timeframe or the EA parameters. Only if the symbol is changed, the blocks would run again, which was probably because I have some symbol-related functions just below this code.
I guess it depends. Maybe the user wants to redraw his objects, maybe not.
Actually these REASON_CHARTCHANGE and REASON_PARAMETERS are forming possible events, something like "on Timeframe Change", or "on Parameters Change". Sometimes I'm thinking about adding some more events in the EA builder, or better changing the way events are used in the EA builder, maybe allowing for making custom events. But at the moment there are only these standard events and the use of REASON_CHARTCHANGE and REASON_PARAMETERS in on Init is opinionated.
By the way, I don't think this is a bug.
-
With the current system, there is just no way for any input changes to take effect immediately. But its ok, I can live with that.
Some event tabs have those specific filters, maybe the OnInit could have similar blocks too...

-
@roar said in When to stop OnInit():
Some event tabs have those specific filters, maybe the OnInit could have similar blocks too...

The problem with this is that if I want to add such blocks, I should remove this code and allow the whole OnInit() body to run always, which can change the behavior of the EAs for some people.
There are such problems everywhere in the EA builder where if I want to change or remove something, unexpected things could happen to many user's projects. And this is not like fixing a bug. If it's a bug, at least I can say "Yeah, but it worked wrong before and now I fixed it".
I think I should somehow make a whole new version of the EA builder, incompatible with this one, on a different link. Like 2.0 or something. Similar to how MT4 and MT5 exist in parallel. But I don't think I have enough breaking changes in mind to justify this.
-
@fxDreema just go ahead with version 2, and finance it with some nice fat partnership contract with some major forex broker
swing for the fences lolThe cock favicon probably would have to go though
-
@roar I had parthership proposals from brokers, and not only brokers, but I always decline. I'm very anti-parthership for some reason, so much that I don't even want to hire someone to do something instead of me. But lately, and especially after the hack, I started to realize that I'm probably not enough for this project and my strong anti-parthership shell is starting to crack a little bit.
But brokers... I look at them as the enemy, although without them this website would not exist. -
@fxDreema I understand, both of your points.
I have just seen some "EA builders" offered by brokers, and they are always miles, light years behind fxdreema. This is the iPhone of EA industry lol
-
@fxDreema Amen, brother!
-
@fxDreema
Interesting, how would a partnership with brokers work ? I mean what would be the way to force the users importing the built EA to the broker ? -
@fxDreema I'm really glad you don't like partners. Partners always have interests that conflict with a best and first vision. One of the reasons FXDreema is ahead of its peers. Creative license for users or devs doesn't play well with controlling partners. You don't need em because its pretty easy to see your user base will have your back with any kind of support needed. I am currently a novice in coding and find this community easy to learn and share ideas with. I wouldn't be here if this were a big box e-tailor. Ive been a trader and in tech for years but I'm soaking it in like a sponge right now!
-
@speedsk8r said in When to stop OnInit():
@fxDreema I'm really glad you don't like partners. Partners always have interests that conflict with a best and first vision. One of the reasons FXDreema is ahead of its peers. Creative license for users or devs doesn't play well with controlling partners. You don't need em because its pretty easy to see your user base will have your back with any kind of support needed. I am currently a novice in coding and find this community easy to learn and share ideas with. I wouldn't be here if this were a big box e-tailor. Ive been a trader and in tech for years but I'm soaking it in like a sponge right now!
to be fair as well though, a good partner pushes you to be better, and strive for more....this is what I look for in someone at least.
-
@TipsyWisdom not the ones I've been in. Plenty of resources to "do better" without another controlling interest. If I need $ to do better it'd be an equity only relationship.
-
@TipsyWisdom We're not talking about women here

-
-
@jstap lol
true true...but a business partner shouldn't be any different in that regard!
-
Hello How can I access your discord group
