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
TBH, I actually prefer to use standard code elements too. I haven't tested the comparative efficiencies of standard versus OOP, but I've always assumed that standard code is faster than accessing external include/library files. Maybe someone else can chime in here and give us the hard facts.
it was my "learnings"; albeit over 20 years ago now -- that lower machine languages, ie languages that use class(es) -- make instructions to hardware "directly", which would under most circumstances use the faster cpu caches or to hardware directly; while mql4/5/python/pine script -- DO NOT.
if anything i said is incorrect, then, please correct me.
but, of course, some of the std library codes may not be 100%, correct syntax required to work with mt5, but if it is, then the std libary code will be faster. But again, if this is wrong info, then, please correct me.it was my "learnings"; albeit over 20 years ago now -- that lower machine languages, ie languages that use class(es) -- make instructions to hardware "directly", which would under most circumstances use the faster cpu caches or to hardware directly; while mql4/5/python/pine script -- DO NOT.
if anything i said is incorrect, then, please correct me.
but, of course, some of the std library codes may not be 100%, correct syntax required to work with mt5, but if it is, then the std libary code will be faster. But again, if this is wrong info, then, please correct me.I don't want to speculate like a know-it-all without factual testing. That's why I assume that include/library files must pass data through MT5 which then, in turn, communicates with an mq5 file─sort of like a terminal-wide GlobalVariable. In contrast, I imagine that standard code elements only communicate with MT5.
Having said that, a machine system file like a DLL is probably faster than any of that─which would be aligned with your learnings. Regarding mqh files, this seems to be an apples versus oranges comparison. I think that we can all agree that an mqh file is not a machine system file.
Obviously, I don't have any "inside" knowledge of the inner workings of MT5. Presumably, we can't because that's proprietary info. I do, however, occasionally Print() test code blocks from start of execution to finish for speed tracking purposes. The only issue there is that there are a multitude of ways to code the same logic, so the test might be somewhat subjective.
If no one chimes in here with more definite info, I'll do such a test and post back with the results measured in milliseconds... when the markets reopen.
If no one chimes in here with more definite info, I'll do such a test and post back with the results measured in milliseconds... when the markets reopen.
my dybamic lotsize is working for buys, BUT NOT FOR SELLS.
so it would seem that my issue was unrelated to my abusing the class. something else.
i have only posted the OnTick and the function that sends the trade. if want more, then i have no issue posting the full files, only posted the excerpt for readability. just ask for full files and they will be posted either via dm or here.
I want possible of 3 lotsizes. initial lot 0.35, others 0.14 and 3rd possible but rare to happen 0.5.
I want initial lot 0.35, and then a gap of 160 points, but trades can still happen in this gap, but those trades in this 160 gap above and below the most recent trade of 0.35 -- will be 0.14.
The first trade that opens outside this 320 gap will be 0.5 -- BUT. only the first trade on losing side of the closest 0.35 trade.
If all 0.35 trades close, then, the next trade that opens will be 0.35.
NOTE this is all working 100% with buy side, but not working at all on sell side. i have 14 trades open in 500 point range, all sell trades, and all same size of 0.35.
And the biggest confusion of all this is that it is working on my backtests, but not on live demo account.
my dybamic lotsize is working for buys, BUT NOT FOR SELLS.
so it would seem that my issue was unrelated to my abusing the class. something else.
i have only posted the OnTick and the function that sends the trade. if want more, then i have no issue posting the full files, only posted the excerpt for readability. just ask for full files and they will be posted either via dm or here.
I want possible of 3 lotsizes. initial lot 0.35, others 0.14 and 3rd possible but rare to happen 0.5.
I want initial lot 0.35, and then a gap of 160 points, but trades can still happen in this gap, but those trades in this 160 gap above and below the most recent trade of 0.35 -- will be 0.14.
The first trade that opens outside this 320 gap will be 0.5 -- BUT. only the first trade on losing side of the closest 0.35 trade.
If all 0.35 trades close, then, the next trade that opens will be 0.35.
NOTE this is all working 100% with buy side, but not working at all on sell side. i have 14 trades open in 500 point range, all sell trades, and all same size of 0.35.
And the biggest confusion of all this is that it is working on my backtests, but not on live demo account.
I'm not going to lie. I can't make heads or tails of your code.
You can achieve 3 irregular lot sizes by simply referencing position volumes, position open prices, current prices, and using some if-then statements. If you're interested in a total rewrite, I'm sure I have an example that I can dig up. Just let me know.
I'm not going to lie. I can't make heads or tails of your code.
You can achieve 3 irregular lot sizes by simply referencing position volumes, position open prices, current prices, and using some if-then statements. If you're interested in a total rewrite, I'm sure I have an example that I can dig up. Just let me know.
that is what i have done in the loop in OnTick. but if you are willing to do the "rewrite", which i think you mean a rewrite of the open trades function, then i am willing to give anything a go at this point. no pun intended.
TBH, I actually prefer to use standard code elements too. I haven't tested the comparative efficiencies of standard versus OOP, but I've always assumed that standard code is faster than accessing external include/library files. Maybe someone else can chime in here and give us the hard facts.