Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
Закрывайте только прибыльные позиции
Код: Закрыть прибыльную позицию.mq5
проверяет позиции по всем символам и по всем магическим числам.
Пользовательская скользящая средняя как ресурс
Код: Пользовательское скользящее среднее как ресурс.mq5
Часто спрашивают: "Если в эксперте используется пользовательский индикатор, то как правильно написать код эксперта, чтобы он работал на MQL5 VPS?".
Ответ таков: индикатор должен быть создан как ресурс. Смотрите пример ниже:
Обратите внимание: я переместил индикатор 'Custom Moving Average' в корневую папку 'Indicators'.
Я скомпилировал индикатор и советник. Советник прикрепил его к графику и выполнил миграцию. Результат работы на MQL5 VPS:
Как видите, все работает отлично!
Добавление индикатора 'iSAR' на график
Код: iSAR ChartIndicatorAdd.mq5
Результат:
У нас есть график с двумя индикаторами: iMA в главном окне и iMACD в подокне.
Запускаем наш советник:
и вкладку "Эксперты":
При переключении таймфрейма:
проверить: смотрит на все индикаторы
и вкладка "Эксперты":
Почему окно, когда оно скрыто, возвращает другие параметры, чем когда оно активно?
Ответ прост - все дело в операционной системе Windows. У окна может быть несколько состояний: окно полностью максимизировано, минимизировано и свернуто. Когда окно неактивно, оно находится в свернутом состоянии (если вы не свернули его раньше). Давайте проверим это. Используем индикатор Bar number - он нумерует бары и служебный индикатор 'CHART_FIRST_VISIBLE_BAR.mq5' - индикатор отображает значение
CHART_FIRST_VISIBLE_BAR
Номер первого видимого бара на графике. Индексация баров соответствуетвременным сериям.
int r / o
Вот что происходит: сначала окно полностью максимизируется, затем минимизируется, и после этого мы переключаемся на другой график (который полностью максимизируем)
Здравствуйте Владимир,
Огромное спасибо за Ваши усилия по созданию многочисленных кодов и советников, которые помогли нескольким новичкам в программировании на MQL5, таким как я, понять зачатки кодирования на языке MQL5.
Пожалуйста, у меня есть этот советник, скопированный и модифицированный из некоторых ваших кодов в соответствии с моей стратегией, которая должна гарантировать, что не более 2 позиций имеют одинаковый размер лота.
Например, только одна позиция Sell и одна Buy могут иметь одинаковый размер лота, т.е. для любого конкретного размера лота можно открыть только одну позицию Buy и одну Sell.
Более того, когда последняя открытая позиция на покупку оказывается в убытке, советник должен открыть позицию на продажу с аналогичным размером лота, и наоборот.
Проблема заключается в том, что советник практически не открывает позицию на продажу, даже когда последняя позиция на покупку в убытке.
Попробуйте этот код:
Попробуйте этот код:
Большое спасибо за помощь. Я попробовал код, как советовали, но обнаружил, что при бэктесте в течение года было открыто максимум 7 позиций, в то время как в некоторые другие годы открывалось только 2 позиции. Пожалуйста, посмотрите полный код ниже:
***
Большое спасибо за помощь. Я попробовал код, как советовали, но обнаружил, что при бэктесте в течение года было открыто максимум 7 позиций, в то время как в некоторые другие годы открывалось только 2 позиции. Пожалуйста, посмотрите полный код ниже:
***
Пожалуйста, никогда не вставляйте код в виде листа текста.
Вам нужно сделать следующее: вставить текст с помощью кнопки и добавить код с помощью кнопки ...
Никогда не вставляйте код в виде листа текста.
Нужно сделать так: вставить текст с помощью кнопки и добавить код с помощью кнопки ...
Большое спасибо за исправление и извинения за ошибку. Пожалуйста, посмотрите полный код, основанный на вашем совете, который открыл максимум 7 позиций в течение года при бэктестинге, в то время как в некоторые другие годы было открыто только 2 позиции:
Однако мой первоначальный код открывал несколько позиций в год, как и ожидалось, но его проблема заключалась в том, что когда последняя открытая позиция на покупку была в убытке, он не смог открыть позицию на продажу, как и предполагалось. Пожалуйста, взгляните на код:
Пожалуйста, помогите, спасибо.