Популярное

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

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

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

Топ запросов

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

MQL4 TUTORIAL BASICS - 40 SIMPLE BUY BREAKEVEN STOP

Автор: MQL4Tutorial

Загружено: 2019-10-19

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

Описание:

https://mql4tutorial.com

With MQL4 for Metatrader4 we create an Expert Advisor that will set a break even stop loss above our buy price when the price is running into our direction. This expert advisor will automatically set the break even stop once a few points of profit are achieved...

In this video we want to find out how to set a breakeven stop, that's the red line here, actually, it's a little bit above the buying price so let's find out how to do that with mql4.

To get started please click on the little icon here or press F4 on your keyboard, now you should see the Metaeditor and here you want to click on file, new, expert advisor from template, continue, I will call this file simple buy breakeven stop, click on continue, continue and finish.

Now you can remove everything above the on tick function and the two comment lines here, we start by checking if we have no open orders, that would be the case if the function orders total delivers a return value of zero, and if that is the case we want to open a test position, you wouldn't do that on a real account but for the strategy tester we need an open position so that we can set the breakeven stop.

We use order send to open a buy trade here and afterwards we want to check if the breakeven stop for the buy trade is okay.

So far this function does not exist so we need to code it now, our custom function does not return any value, it is called check buy breakeven stop, we use orders total to get the number of all the orders and this loop here will count down until there are no orders left, we check if the selected order is actually an open position, we do that by using order select for the current number of the position, we use select by position – all in capital letters – and we use mode underscore trades. If you mark that and press the F1 key you will learn that mode underscore trades will be used to find open and pending orders, while mode history would be used if we need cancelled and closed orders, so if we have an open position we want to check if the order symbol actually is equal to the currency pair on our chart, and we want to know if the order type equals op underscore buy and if that is the case we actually have a buy position.

We also want to know if the order stop loss is below the order open price because it doesn't make much sense to set a breakeven stop when the current stop loss would be far above the open price and finally we need to check if the current ask price is above the order open price – in my case actually I want to set the breakeven stop when it's thirty points above the open price – and only if all those conditions are true we want to use order modify to move the stop loss to four points above the open price for the current order ticket that was opened for the order open price, we set the stop loss to order open price plus four points, the order take profit will remain unchanged, that's also true for the last two parameters, we don't have an expiration value so we set it to zero, and we use clr underscore none because we don't need any color, please don't forget to set two curly braces here, one is to close the for loop and the other one to the function and that's about it.

If you don't know what all the code here does or if this was too fast for you maybe you want to watch the other videos in this basic video series or maybe even the premium course on the website is interesting for you, for now, please click on the compile button or press F7, you shouldn't get any errors here, we only have one warning, we could check the return value for order modify but for this simple example we don't need to do that, so if you don't have any errors please click on a little button here or press F4 to go back to Metatrader.

And in Metatrader we click on view, strategy tester or press control and r, please pick the new file simple buy breakeven stop dot ex4, mark the visual mode here and start a test.

So let's zoom into the chart, we have opened a buy trade and here comes the breakeven stop, so in this little video, you have learned how to automatically set a breakeven stop once your buy trade is going into the right direction and you have coded it yourself with a few lines mql4 code.

MQL4 TUTORIAL BASICS - 40 SIMPLE BUY BREAKEVEN STOP

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

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

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

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

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

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

MQL4 TUTORIAL BASICS - 75 SIMPLE TIME FILTER

MQL4 TUTORIAL BASICS - 75 SIMPLE TIME FILTER

Обзор 360° с высоты птичьего полёта | Майами — Багамы | American Eagle E-175

Обзор 360° с высоты птичьего полёта | Майами — Багамы | American Eagle E-175

Почему Путин накачал НАТО оружием и деньгами?

Почему Путин накачал НАТО оружием и деньгами?

Building a Custom Dividend Stock Scan on thinkorswim | Investing in Dividend Stocks

Building a Custom Dividend Stock Scan on thinkorswim | Investing in Dividend Stocks

S&P 500 Set To Break One Way Or Another

S&P 500 Set To Break One Way Or Another

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

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

MES | СПА | Путь Программиста | Структура Компании | Товарные Запасы | Склады | Бухгалтерские Формы

MES | СПА | Путь Программиста | Структура Компании | Товарные Запасы | Склады | Бухгалтерские Формы

mql5 Programming Tutorial - Break Even Stop - Part 5

mql5 Programming Tutorial - Break Even Stop - Part 5

MQL4 TUTORIAL BASICS - 89 SIMPLE HIGH PRICE TREND LINE

MQL4 TUTORIAL BASICS - 89 SIMPLE HIGH PRICE TREND LINE

MQL4 TUTORIAL BASICS - 56 SIMPLE CLOSE TIMER

MQL4 TUTORIAL BASICS - 56 SIMPLE CLOSE TIMER

Jesz to? Błąd - TRACISZ KOLAGEN (płacimy za to zdrowiem...)

Jesz to? Błąd - TRACISZ KOLAGEN (płacimy za to zdrowiem...)

MQL4 TUTORIAL BASICS - 82 SIMPLE SMA TRAILING STOP LOSS

MQL4 TUTORIAL BASICS - 82 SIMPLE SMA TRAILING STOP LOSS

MQL4 TUTORIAL BASICS - 64 SIMPLE MULTIPLE RSI

MQL4 TUTORIAL BASICS - 64 SIMPLE MULTIPLE RSI

Tańczmy, Póki Świt – Do Tańca, Do Radości, Do Rana

Tańczmy, Póki Świt – Do Tańca, Do Radości, Do Rana

MQL4 TUTORIAL BASICS - 53 SIMPLE FIBONACCI OBJECT

MQL4 TUTORIAL BASICS - 53 SIMPLE FIBONACCI OBJECT

MQL4 TUTORIAL BASICS - 78 SIMPLE MULTI CURRENCY ORDER

MQL4 TUTORIAL BASICS - 78 SIMPLE MULTI CURRENCY ORDER

Stop Using Volume Wrong! Learn These 3 Phases to Win More Trades

Stop Using Volume Wrong! Learn These 3 Phases to Win More Trades

MQL4 TUTORIAL BASICS - 94 SIMPLE SPREADSHEET FILE WRITER

MQL4 TUTORIAL BASICS - 94 SIMPLE SPREADSHEET FILE WRITER

Учебное пособие по программированию на MQL5 с использованием стратегии «Обратная развертка»

Учебное пособие по программированию на MQL5 с использованием стратегии «Обратная развертка»

MQL4 TUTORIAL BASICS 41 SIMPLE SELL BREAKEVEN STOP

MQL4 TUTORIAL BASICS 41 SIMPLE SELL BREAKEVEN STOP

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



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



Контакты для правообладателей: infodtube@gmail.com