[...]
This showed me intentional manipulation in the code of MT4 program to make trades not be taken when they should be, because the EA (and Comments) are not seeing the signal as being triggered.
No, it's a fault in the EA code. What's happening on my machine when I try this out is as follows:
- The EA eventually generates a buy or sell signal (when the previous and in-progress bars are in the same direction).
- It tries to place an order, but fails because it decides it hasn't got enough money. And writes an entry to the log using Print().
- The code contains a return (0) in its block of trading code. This causes it to exit before the comments on screen are updated.
Therefore, the comments on screen do not get updated if the EA is repeatedly trying and failing to submit an order. That's certainly the problem I'm seeing. The comments on screen don't reflect what the EA is trying - but failing - to do internally.
In addition, the logging isn't correct. The message "Error opening BUY/SELL order" only gets logged in the hugely unlikely event that an OrderSelect() fails immediately after successful order placement. It's not logging order failure returning a zero ticket number. The else { clause looks to be attached to the wrong if block.
jjc, you have the patience of a saint and diplomatic skills of the best... ;)
Additionally, NormalizeDouble() is nowhere to be seen - do not people get it???
btw, can you put me onto any source code formatter?
Have yet to come across anything that can manage. Tidy springs to mind but not tidy for me.
Ta Vmuch
jjc, you have the patience of a saint and diplomatic skills of the best... ;)
That's the exact opposite of what my colleagues, clients, and all my friends say, but thanks anyway.
fbj wrote >>
btw, can you put me onto any source code formatter?
MQL "feels" to me like Javascript, and I'm so used to writing Javascript in a plain text editor that MetaEditor's colour-coding and Compile button feel like the height of luxury. So, sorry, but I don't have any recommendations (other than a generic one for Visual Studio).
Oh sure, I can understand perfectly your comment. I grew up using a wide bodied printer/tty for 4yrs as my viewport into another magical world and ed's were all kicked with single cmds todo single acts... and actually, I'd go back now if poss!
luddite springs to mind :-)
Thanks to smjones for correcting me.
Don
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I figured I would make as simple an EA as possible, after making hundreds of unprofitable EAs over the past year.
The Buy and Sell Conditions are simple as can be:
if(LastCandleUp == True && ThisCandleUp == True && LastCandleDown == False && ThisCandleDown == False) Order = SIGNAL_BUY;
if(LastCandleUp == False && ThisCandleUp == False && LastCandleDown == True && ThisCandleDown == True) Order = SIGNAL_SELL;
When this EA is put on the chart (no matter what chart, no matter what broker), the Comments are wrong.
When you see the last bar as an up bar, the Comments are correct on that part. But when this bar is an up bar also, the Comments show as the bar as flat, not up. So the Buy trade not taken.
When you see the last bar as a down bar, the Comments are correct on that part. But when this bar is a down bar also, the Comments show as the bar as flat, not down. So the Sell trade not taken.
If the last bar was up and this bar down, or the last bar down and this bar up, the Comments are correct.
This showed me intentional manipulation in the code of MT4 program to make trades not be taken when they should be, because the EA (and Comments) are not seeing the signal as being triggered.
So I tried to get around the purposeful sabotage of MT4 creators that is coded into MT4 - the program, and made the Buy and Sell conditions to be the same as what the Comments showed when the Buy and Sell Conditons were correct, but the Comments were wrong:
if(LastCandleUp == True && ThisCandleUp == False && LastCandleDown == False && ThisCandleDown == False) Order = SIGNAL_BUY;
if(LastCandleUp == False && ThisCandleUp == False && LastCandleDown == True && ThisCandleDown == False) Order = SIGNAL_SELL;
I put "NOT" in the name of this EA. I figured it might make the trades now. Did it? NOT, LOL. Now the Buy and Sell Conditions in the EA are not what I want, the Comments are correct to what is seen when looking at bars on chart! So of course no trades were taken!
This is just more proof that manipulation exists in the MT4 code itself, and not in the broker or the indicator or EA writer. The EA code can be correct, but not work, because of this manipulation.
I can see now why my EA's fail, when something this simple is being manipulated. I have seen much more evidence (such as inconsistencies of reliable indicators' values being seen by an EA). So I'm not still broke just because I have bad strategies (over a hundred or two hundred EAs, and you start to wonder how all could be bad, when the indicators are good, and/or the strategies are good. This simple test shows how).
What can be done? Will MetaQuaotes fix it, or remove my post and stop me from posting further?
Don