По поводу числа - поиск рулит . https://www.mql5.com/ru/search
Rosh, привет!
Поискал, почитал, но так что-то до конца и не понял. Попробую объснить по другому суть проблемы, или я не понимаю чего-то.
Вообщем индикатор рисует и показывает все правильно. Если его засунуть в эксперт с помощью iCustom(), то первое значение буфера iCustom(...0,1) выдает правильное, а остальные iCustom(...1,1) и т.д. до iCustom(...4,1) первые три значения правильные а после третьего бара от iCustom(...1,0) до iCustom(...4,0), значение 2147483647. Если ставлю SetIndexEmptyValue то 2147483647 заменяется 0. При остановке визуализации индикатор рисуется правильный (если это поможет). Прогонял в обычном режиме, в онлайне так сказать, то же самое. В чем причина? Как мне получить все значения индикатора в эксперте? В архиве индюк и эксперт. Если не сложно посмотри пожалуйста.
С Уважением!
//+------------------------------------------------------------------+ //| alx_idx_rbm.mq4 | //| ИНДЮК babon82@gmail.com| //+------------------------------------------------------------------+ #property copyright "alx_idx_rbm" #property link "babon82@gmail.com" #property stacksize 1024 //---- #property indicator_separate_window #property indicator_buffers 5 #property indicator_color1 Yellow #property indicator_color2 DarkBlue #property indicator_color3 White #property indicator_color4 White #property indicator_color5 White //---- input parameters extern int RSI_Period = 8; extern int MA_Period = 8; extern int BB_Period = 20; extern double RSI=0.0; extern double MA=0.0; extern double BB_Upp=0.0; extern double BB_Low=0.0; extern double BB_Mai=0.0; //---- buffers double RSI_Buff[]; double MA_Buff[]; double BUpp_Buff[]; double BLow_Buff[]; double BMain_Buff[]; string text; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorBuffers(5); SetIndexBuffer(0, RSI_Buff); SetIndexBuffer(1, MA_Buff); SetIndexBuffer(2, BUpp_Buff); SetIndexBuffer(3, BLow_Buff); SetIndexBuffer(4, BMain_Buff); SetIndexStyle(0, DRAW_LINE,0,2); SetIndexStyle(1, DRAW_LINE,0,2); SetIndexStyle(2, DRAW_LINE,1,0); SetIndexStyle(3, DRAW_LINE,1,0); SetIndexStyle(4, DRAW_LINE,1,0); IndicatorShortName("RSI("+RSI_Period+") BANDS("+BB_Period+") MA("+MA_Period+")"); SetIndexLabel(0, "RSI"); SetIndexLabel(1, "MA"); SetIndexLabel(2, "BANDS"); SetIndexLabel(3, "BANDS"); SetIndexLabel(4, "BANDS"); SetIndexEmptyValue(0,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; limit = Bars - counted_bars; for(int i = limit; i >= 0; i--) { RSI_Buff[i] = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, i); } for(i = limit-MA_Period; i >=0; i--) { MA_Buff[i]=iMAOnArray(RSI_Buff,0,MA_Period,0,MODE_LWMA,i); } for(i=limit-BB_Period;i>=0;i--) { BUpp_Buff[i] = iBandsOnArray(RSI_Buff,0,BB_Period,2,0,MODE_UPPER,i); BLow_Buff[i] = iBandsOnArray(RSI_Buff,0,BB_Period,2,0,MODE_LOWER,i); BMain_Buff[i] = iBandsOnArray(RSI_Buff,0,BB_Period,2,0,MODE_MAIN,i); } return(0); } //+------------------------------------------------------------------+
И САМ ЭКСПЕРТ
//+------------------------------------------------------------------+ //| alx_RSI_BANDS_MA.mq4 | //| babon82@gmail.com | //+------------------------------------------------------------------+ #property copyright "alx_Babon" #property link "babon82@gmail.com" extern int RSI_Period=8; extern int MA_Period=8; extern int BB_Period=20; extern int SmoothType=0; int init() { //2147483647.0000 return(0); } int deinit() { return(0); } int start() { double RSI=00.0000,MA=00.0000,BB_Up,BB_Lo,BB_Ma; RSI = iCustom(NULL,0,"alx_idx_rbm1",RSI_Period,MA_Period,BB_Period,0,1); MA = iCustom(NULL,0,"alx_idx_rbm1",RSI_Period,MA_Period,BB_Period,1,1); BB_Up = iCustom(NULL,0,"alx_idx_rbm1",RSI_Period,MA_Period,BB_Period,2,1); BB_Lo = iCustom(NULL,0,"alx_idx_rbm1",RSI_Period,MA_Period,BB_Period,3,1); BB_Ma = iCustom(NULL,0,"alx_idx_rbm1",RSI_Period,MA_Period,BB_Period,4,1); Comment ( "RSI="+RSI,"\n" ,"MA="+MA,"\n" ,"BB_Up="+BB_Up,"\n" ,"BB_Main="+BB_Ma,"\n" ,"BB_Lo="+BB_Lo,"\n" ); return(0); } //+------------------------------------------------------------------+
for(i = limit+MA_Period; i >=0; i--)
{
MA_Buff[i]=iMAOnArray(RSI_Buff,0,MA_Period,0,MODE_LWMA,i);
}
for(i=limit+BB_Period;i>=0;i--)
//+------------------------------------------------------------------+ //| alx_idx_rbm.mq4 | //| ИНДЮК babon82@gmail.com| //+------------------------------------------------------------------+ #property copyright "alx_idx_rbm" #property link "'Подскажите! Советник на пользовательских индикаторах!'" #property stacksize 1024 //---- #property indicator_separate_window #property indicator_buffers 5 #property indicator_color1 Yellow #property indicator_color2 DarkBlue #property indicator_color3 White #property indicator_color4 White #property indicator_color5 White //---- input parameters extern int RSI_Period = 8; extern int MA_Period = 8; extern int BB_Period = 20; extern double RSI=0.0; extern double MA=0.0; extern double BB_Upp=0.0; extern double BB_Low=0.0; extern double BB_Mai=0.0; //---- buffers double RSI_Buff[]; double MA_Buff[]; double BUpp_Buff[]; double BLow_Buff[]; double BMain_Buff[]; string text; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //IndicatorBuffers(5); SetIndexBuffer(0, RSI_Buff); SetIndexBuffer(1, MA_Buff); SetIndexBuffer(2, BUpp_Buff); SetIndexBuffer(3, BLow_Buff); SetIndexBuffer(4, BMain_Buff); SetIndexStyle(0, DRAW_LINE,0,2); SetIndexStyle(1, DRAW_LINE,0,2); SetIndexStyle(2, DRAW_LINE,1,0); SetIndexStyle(3, DRAW_LINE,1,0); SetIndexStyle(4, DRAW_LINE,1,0); IndicatorShortName("RSI("+RSI_Period+") BANDS("+BB_Period+") MA("+MA_Period+")"); SetIndexLabel(0, "RSI"); SetIndexLabel(1, "MA"); SetIndexLabel(2, "BANDS"); SetIndexLabel(3, "BANDS"); SetIndexLabel(4, "BANDS"); SetIndexEmptyValue(0,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i,limit,limit1; int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) { limit = Bars - counted_bars; limit1=limit; } if(counted_bars == 0) { limit = Bars - RSI_Period; limit1=limit-BB_Period; } for(i = limit; i >= 0; i--) { RSI_Buff[i] = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, i); } for(i = limit1; i >=0; i--) { MA_Buff[i]=iMAOnArray(RSI_Buff,0,BB_Period,0,MODE_LWMA,i); } for(i=limit1;i>=0;i--) { BUpp_Buff[i] = iBandsOnArray(RSI_Buff,0,BB_Period,2,0,MODE_UPPER,i); BLow_Buff[i] = iBandsOnArray(RSI_Buff,0,BB_Period,2,0,MODE_LOWER,i); BMain_Buff[i] = MA_Buff[i]; } return(0); } //+------------------------------------------------------------------+
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Вы принимаете политику сайта и условия использования
Вопрос следующего плана:
Есть пользовательский индикатор, основанный на 3-х стандартных, RSI, MA, Bollinger, причем MA и Bollinger расчитываются от RSI. На основе этого индикатора пытаюсь написать эксперта. С помощью
получается что мне возврщается только значение RSI, а мне нужно чтобы он возвращал значения MA и Bollinger. Также при тестировании и прогоне на счете первые 4 значения идут правильные, а потом оно постоянно показывает = 2147483647.
В чем ошибка, или такого вообще не возможно!