У нас вы можете посмотреть бесплатно MQL5 TUTORIAL - Buy Position Closer explained (in 5 min) или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
https://mql5tutorial.com/?s=buy+position https://mql5tutorial.com/?s=position+... In this video, we are going to create an Expert Advisor that manages trading positions based on certain conditions. Let's see how we can do that. First, we start Metaeditor by clicking the little icon or pressing F4. We begin by including the Trade.mqh file, which provides us with the necessary trading functions. We then create an instance of the CTrade class, which will be used to execute trade operations. In the OnTick function, which is called every time a new tick is received, we first get the current Ask price. This is done by using the SymbolInfoDouble function with the SYMBOL_ASK parameter, and we normalize the value to the number of digits for the current symbol. Next, we check if the total number of open positions is less than 10. If this condition is met, we open a buy position of 0.10 lots (which is 10 micro lots) at the current Ask price. The stop loss is set to 1000 points below the Ask price, and the take profit is set to 150 points above the Ask price. If the total number of open positions is exactly 10, we call the CloseAllBuyPositions function to close all open buy positions. The CloseAllBuyPositions function iterates through all open positions in reverse order. For each position, it retrieves the ticket number and the position type. If the position is a buy position, it closes the position using the PositionClose function. Finally, we press F7 to compile the code. If this was too fast for you or if you don't understand what all the code is doing, you may want to check out the Premium course on our website, or watch one of the basic videos first. If the compilation is successful, we go back to MetaTrader by pressing F4 or clicking on the icon. Back in MetaTrader, we press Control and R to start the strategy tester, pick the Expert Advisor that we have just created, enable the visual mode, and start a strategy test. We should then see the Expert Advisor on the chart. If you are already a Premium course member and have an idea for a video like this one, you can send us an email. In this video, we have learned how to create an Expert Advisor that opens buy positions and closes them based on the number of open positions. We have coded this with a few lines of MQL code. Thanks for watching, and I will see you in the next video.