Оформляйте код, не стесняйтесь. Кнопка MQL.
Простите, еще не разобрался в особенностях создания тем
Попробуйте открыть Data Window и посмотреть значения Вашего индикатора
в нем. Наверняка, средняя не совсем "пропадает".
Проверил:
1. Сразу после компиляции окно обновляется и появляются две линии, в Окне данных 2 значения
2. после смены таймфренда - одна линия, и в окне данных второе значение пустое
3. при вставке индикатора тоже одна линия
1. Сразу после компиляции окно обновляется и появляются две линии, в Окне данных 2 значения
2. после смены таймфренда - одна линия, и в окне данных второе значение пустое
3. при вставке индикатора тоже одна линия
//+------------------------------------------------------------------+ //| Наклон средней.mq4 | //| Copyright © 2006, Aleh Shynkevich | //| None | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, Aleh Shynkevich" #property link "None" //---- #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- input parameters extern int Период = 144; extern int Метод = 0; extern int Цена = 5; extern int ПериодНаклона = 5; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0, DRAW_LINE); SetIndexBuffer(0, ExtMapBuffer1); SetIndexStyle(1, DRAW_LINE); SetIndexBuffer(1, ExtMapBuffer2); //---- IndicatorDigits(Digits + 1); //---- IndicatorShortName("НаклСр (" + Период + ", " + Метод + ", " + Цена + ")"); SetIndexLabel(0, "Main"); SetIndexLabel(1, "Signal"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars = IndicatorCounted(); //---- int limit; if(counted_bars == 0) counted_bars++; limit = Bars - counted_bars; for(int ind = limit; ind >= 0; ind--) ExtMapBuffer1[ind] = iMA(NULL, 0, Период, 0, Метод, Цена, ind) - iMA(NULL, 0, Период, ПериодНаклона, Метод, Цена, ind); for(ind = limit; ind >= 0; ind--) ExtMapBuffer2[ind] = iMAOnArray(ExtMapBuffer1, 0, 25, 0, Метод, ind); //---- return(0); } //+------------------------------------------------------------------+
как я понял проблема в том, что значения считал в одном цикле?
Спасибо за подсказку и код
Спасибо за подсказку и код
Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
Сделал индикатор НаклонСредней, после компиляции отражаются две линии, а после смены таймфренда, средняя исчезает
В чем может быть проблема???