Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1804

 
MakarFX #:

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.

 
Mihail Matkovskij #:

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.

You see how complicated it is))) This robot is designed to work on current price signals.
 
Mihail Matkovskij #:

At the moment I have some work to do. When I need work, I will write.

Whatever you say. It's not for me, there is a customer, but my knowledge is lacking.
 
MakarFX #:
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.

 
MakarFX #:
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.

 
MakarFX #:

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.

 
Mihail Matkovskij #:

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.

 
Artyom Trishkin #:

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... :)

 
Mihail Matkovskij #:

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.

 
Mihail Matkovskij #:
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.


I had a variant with creation of only one line and change of object's colour property - no such tricks were observed there.
Reason: