ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

MQL5 Tutorial - Simple Sell Position Close explained (in 4 min)

Автор: MQL5 Tutorial

Загружено: 2024-07-01

Просмотров: 857

Описание: https://mql5tutorial.com/?s=sell+posi...

In this video, we are going to create an Expert Advisor that opens and closes sell 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 library, which provides functions for trading operations. We then create an instance of the CTrade class named trade.

In the OnTick function, which is called on every tick, we first get the current Bid price and normalize it to the number of digits specified for the symbol.

Next, we check if the total number of positions is less than 10. If this condition is met, we open a sell position of 0.10 lots, which is equivalent to 10 micro lots. The trade.Sell function takes several parameters: the lot size (0.10), the symbol (NULL for the current symbol), the price (Bid), the stop loss (Bid + 1000 * _Point), the take profit (Bid - 150 * _Point), and a comment (NULL).

If the total number of positions is exactly 10, we call the CloseAllSellPositions function to close all open sell positions.

The CloseAllSellPositions function iterates through all open positions in reverse order. For each position, it retrieves the ticket number and the position type. If the position type is a sell position, it closes the position using the trade.PositionClose function.

At the end, 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 works, 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 and closes sell positions based on the number of open positions. We have coded this Expert Advisor ourselves with a few lines of MQL code.

Thanks for watching, and I will see you in the next video.

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
MQL5 Tutorial - Simple Sell Position Close explained (in 4 min)

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

MQL5 TUTORIAL - Buy Position Closer explained (in 5 min)

MQL5 TUTORIAL - Buy Position Closer explained (in 5 min)

White House Watchlist: 3 Stocks Trump Could Take a Stake In Next

White House Watchlist: 3 Stocks Trump Could Take a Stake In Next

25 Запрещенных Гаджетов, Которые Вы Можете Купить Онлайн

25 Запрещенных Гаджетов, Которые Вы Можете Купить Онлайн

Учебник по Shopify для начинающих (Полная настройка магазина)

Учебник по Shopify для начинающих (Полная настройка магазина)

Как мошенники воруют крипту, не взламывая кошельки

Как мошенники воруют крипту, не взламывая кошельки

Moving Average Crossover EA mql5 Programming

Moving Average Crossover EA mql5 Programming

Это снова повторяется, и никто об этом не говорит.

Это снова повторяется, и никто об этом не говорит.

Ил-76. Забытое преступление

Ил-76. Забытое преступление

Трейдинг когда мало денег: как разогнать маленький депозит?

Трейдинг когда мало денег: как разогнать маленький депозит?

1 простая торговая стратегия, которую я использовал, чтобы заработать миллионы

1 простая торговая стратегия, которую я использовал, чтобы заработать миллионы

MQL5 TUTORIAL - SIMPLE POSITION CLOSE

MQL5 TUTORIAL - SIMPLE POSITION CLOSE

Фьючерсы: самое ПРОСТОЕ объяснение для новичков [Трейдинг с нуля]

Фьючерсы: самое ПРОСТОЕ объяснение для новичков [Трейдинг с нуля]

Учебник по monday.com для начинающих

Учебник по monday.com для начинающих

ЛУЧШИЙ КОНСТРУКТОР САЙТОВ ГОДА (мой ТОП рекомендаций)

ЛУЧШИЙ КОНСТРУКТОР САЙТОВ ГОДА (мой ТОП рекомендаций)

Учебное пособие по ClickUp — Как использовать ClickUp для начинающих

Учебное пособие по ClickUp — Как использовать ClickUp для начинающих

mql5 Programming Tutorial - Partial Close Of Positions - Part 4

mql5 Programming Tutorial - Partial Close Of Positions - Part 4

Master MQL5 Programming (Complete All In One Guide)

Master MQL5 Programming (Complete All In One Guide)

Экстремальная ситуация на рынке газа. Что делать?

Экстремальная ситуация на рынке газа. Что делать?

Elena Rybakina v Iga Swiatek Highlights | Australian Open 2026 Quarterfinal

Elena Rybakina v Iga Swiatek Highlights | Australian Open 2026 Quarterfinal

Запись Потоков Данных в Базу Данных в Реальном Времени | Fetch Data | Объекты в Программировании

Запись Потоков Данных в Базу Данных в Реальном Времени | Fetch Data | Объекты в Программировании

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]