У нас вы можете посмотреть бесплатно MQL5 TUTORIAL - Dynamic Sell Position explained (in 4 min) или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
https://mql5tutorial.com/?sell+position +size In this video, we are going to create an Expert Advisor that performs a simple trading strategy based on the account's equity and balance. Let's see how we can do that. First, we need to start Metaeditor by clicking the little icon or pressing F4. We begin by including the Trade.mqh file, which provides us with trading functions. Then, we create an instance of the CTrade class called trade, which we will use to execute our trading operations. Inside the OnTick function, which is called every time a new tick is received for the symbol, we start by calculating the Bid price. We use the SymbolInfoDouble function with the SYMBOL_BID parameter to get the current Bid price for the symbol. The NormalizeDouble function is used to round the Bid price to the number of digits specified by _Digits. Next, we calculate the account's equity using the AccountInfoDouble function with the ACCOUNT_EQUITY parameter. Similarly, we calculate the account's balance using the AccountInfoDouble function with the ACCOUNT_BALANCE parameter. We then calculate the position size by dividing the equity by 100,000 and rounding the result to two decimal places using the NormalizeDouble function. This gives us the position size in lots. We check if the equity is at least equal to the balance. If this condition is true and there are no open positions (checked using the PositionsTotal function), we proceed to open a sell position. We use the trade.Sell function to execute the sell order. The parameters for the Sell function are the position size, the symbol (NULL for the current symbol), the Bid price, the take profit price (Bid + 150 points), the stop loss price (Bid - 150 points), and a comment (NULL). Finally, we create a chart output using the Comment function to display the balance, equity, and position size on the chart. Once we have written the code, we press F7 to compile it. 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 code compiles successfully, 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 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 a sell position based on the account's equity and balance with just a few lines of MQL code. Thanks for watching, and I will see you in the next video.