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
Wait, you have a time limit on trading there... Doesn't the time of trawl fall under those restrictions? though no, wrong stop, strange
Your Expert Advisor is set to run from 09:00:00 to 09:01:00 Moscow time only to open a position. No problems with position opening. The Expert Advisor was installed on a demo account in the PSB-Forex trading platform.
I decided to put the Expert Advisor on my demo account in MetaQuote MT5 trading terminal. Everything has worked as it should but the 10016 trade server return code still remains. Very interesting! I will try to analyze the matter.
Yours sincerely, Vladimir.
Valery, what is the freeze level? Maybe it needs to be prescribed in some way in the code?
Regards, Vladimir.
Freezing distance is more correctly, it is the distance from a market order/position in which orders are not allowed to be executed. Stops cannot be placed in this area. Use your estimated stop as the Parameter and you will get the required one in the output. The code is for 4k. The logic is the same in 5. The MarketInfo parameter seems to be the same.
For 5
SYMBOL_TRADE_FREEZE_LEVEL
Trading operations freezing distance (in points)
int
The freeze distance is correct, the distance from the market order/position in which orders are not allowed to be executed. Stops cannot be placed in this area. Use your estimated stop as the Parameter, and you will get the desired one in the output. The code is for 4k. The logic is the same in 5. The MarketInfo parameters seem to be the same.
Thank you, Valeriy! I will continue to improve the code of the Expert Advisor.
Regards Vladimir.
Thank you, Valery! I will continue to understand and improve the Expert Advisor code.
Sincerely, Vladimir.
Please send me function of stop calculation and position modification. Code is long, not much time)))))
Please upload the stop calculation and position modification function here. The code is long, not much time)))))
Valery, there is no function to calculate the stop because it is set in the input parameters like this:
and in the code for the Buy position the following line is prescribed:
request.sl=NormalizeDouble(price-SL*point,digits);
Thank you, Valery, but I want to deal with modification of stop loss myself. I already have enough information to improve the Expert Advisor myself.
Regards, Vladimir.
Valery, there is no function to calculate the stop, because it is set in the input parameters like this:
And in the code for Buy position the following line is prescribed:
Thank you, Valery, but I want to deal with modification of stop loss myself. I already have enough information to improve the Expert Advisor myself.
Sincerely, Vladimir.
And also price, SL and point to be sure)
And also for sure price, SL and point)
Thank you, Valery!
Sincerely, Vladimir.
The freeze distance is correct, the distance from the market order/position in which orders are not allowed to be executed. Stops cannot be placed in this area. Use your estimated stop as the Parameter, and you will get the desired one in the output. The code is for 4k. The logic is the same in 5. The MarketInfo parameter seems to be the same.
For 5
SYMBOL_TRADE_FREEZE_LEVEL
Trading operations freezing distance (in points)
int
Thank you, Valery for the clarification.
Regards, Vladimir.
Good day and good mood everyone!
I continue studying the MQL5 programming language. Today is the time when I can put the code of the Expert Advisor with a trailing stop to the public view. Since the code of the Expert Advisor is quite cumbersome, I had to cut the comments as much as possible and publish it as a file called Trailing_Stop (v.1).mq5. I will publish the version of the Expert Advisor with detailed comments on each code line, in a form easy to understand for a 1st year student of a programming school, a little later.
Before publishing the code, we checked the Expert Advisor in the strategy tester. No problems were detected. The netting system of position accounting is used in the Expert Advisor. This system of accounting means that at one point in time on the account, there can be only one open position for the same symbol (security).
At this point in time, the Expert Advisor has implemented the ability to:
This version of the Expert Advisor partially implements the hints earlier suggested by Vassily Sokolov. All additions and detailed comments will be included in the final version of the EA.
WARNING!!!
This Expert Advisor is developed according to the self-study plan for demo accounts, and it is intended for training purposes only! It is not intended for trading on a real account and making profit!
Regards, Vladimir.
Dear participants and readers of this thread!
I was sitting up all night trying to figure out why the previously published file with the Expert Advisor code, which had a defect, could not be replaced with the corrected version. By morning I finally figured it out!
Frankly speaking, I did not think that if one of the forum participants had already downloaded the file Trailing_Stop.mq5 with a defect, it would not be possible to simply download and replace the file with a corrected one with the same name. It turned out that you should also change the name of the EA in order to publish the corrected variant.
Due to this fact, I apologize and propose to download the corrected version of the Expert Advisor named Trailing_Stop (v.1).mq5 that is located in the previous message.
Regards, Vladimir.