Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1804
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
I have a suggestion. Give me your telegram in private.
I have some work to do at the moment. When I need work, I will write.
In this case, it needs to be reworked so that it doesn't get twisted. Because the code I've added is designed for a robot with opening price signals, as I said before. I thought: This is strange. And then I found the reason. If you get it right from the beginning, you won't have any problems in the future. Thus, you should always look for the cause and not for the consequence.
At the moment I have some work to do. When I need work, I will write.
You see how complicated everything is))) This robot is designed to work on the signals of the current price.
The real difficulty will be if you don't get it right (don't eliminate the cause of the algorithm's complexity, as I've already said). Therefore, you need to do the following (I repeat it again):
Forum on trading, automated trading systems and testing trading strategies
Any questions from newbies on MQL4 and MQL5, help and discussion of algorithms and codes
Mihail Matkovskij, 2021.12.08 21:20
If that's the case, the MA should be taken with index 1 on the lower timeframe. Then there will be no need to make any changes. Within the Open and Close of the major TF, there will be several (or many) bars on the minor one. You know why timeframes were invented, don't you? If not, then start studying this question from the history of the Japanese candlesticks. In brief, the point is to simplify technical analysis. And with the advent of the digital age, it also simplifies the discretization of trading systems.
Although, let the law-abiding citizen decide what to do. I think he will be completely confused by reading all of the above. But that is what programming is all about. If you do not want to be confusedin the future, then clearly state your algorithm now!
The same applies to Nerd Trader, who was confused for the same reason. He couldn't figure out what to do with his application. The entire forum rescued him, but alas, nothing helped .) Because, he stubbornly refused to figure out the cause of his problem.
Artem, the strategy there provides for one order in the market until it closes at TP or SL.
And for the next strategy, will we need to rewrite the code? And what if the person who finally wrote his EA and tested it wants to try adding to the existing position? Everything will have to be redone.
I'm not saying it's wrong. I'm saying that it would be shortsighted to create a new EA each time. The framework should be written once and then we can assemble everything we need by adding new algorithms without any serious modifications.
The same way as you suggested could be done if the code was in MQL5. Then the OnTradeTransaction event could be handled. And we would be able to check there that the order has been opened. The new open time of a bar can be also recorded there. Then everything would work like clockwork. And in MQL4 we still need to think out how to catch the moment of a new order opening. So, it is a complication in any case.
The same way as you suggested could be done if the code was in MQL5. Then the OnTradeTransaction event could be handled. And we would be able to check there that the order has been opened. The new open time of a bar can be also recorded there. Then everything would work like clockwork. And in MQL4 we still need to think out how to catch the moment of a new order opening. It all turns out to be one complication anyway.
Everything was invented long ago.
Everything has long since been stolen invented.
I have already said that I don't have the opportunity to go into these details now, as I am working on my own project. I've already wasted a lot of time on correspondence as it is. I should have just caught on... :)
I have already said that I don't have the opportunity to go into these details at the moment because I am working on my own project. I have already wasted a lot of time on correspondence. I should have just got caught up... :)
OK.
The same applies to the Nerd Trader user, who was confused for all the same reason. He couldn't figure out what to do with his application. The whole forum rescued him, but alas, nothing helped him .) Because, he stubbornly refused to figure out the cause of his problem.
Nothing like that, I've already solved the problem (partially), and by hiding/displaying instead of recreating. When you click the button everything works as it should (a line to set the order appears), but I also implemented the mountain key, that's the nasty thing with it:
Pressing W presses the SO button, a yellow line should appear ( as the cursor is below the Bid ) in place of the cursor, but green appears because it is above the Asc. Pressing W again releases the button and the line should disappear from the graph, but the scenario repeats: the line is thrown up again, and is only hidden when the cursor is moved.