Вот если честно, настолько непривычны все эти игреки иксы, сложно копать по тексту, можно названия переменных как-нибудь изменить, чтобы стало понятней что есть что?
David177:
Вот если честно, настолько непривычны все эти игреки иксы, сложно копать по тексту, можно названия переменных как-нибудь изменить, чтобы стало понятней что есть что?
Вы думаете ошибка в расчетах индикатора? А оформление самого индикатора верно?
Вот если честно, настолько непривычны все эти игреки иксы, сложно копать по тексту, можно названия переменных как-нибудь изменить, чтобы стало понятней что есть что?
кстати, как этот код из MQL4 записать в MQL5 ?
int counted_bars=IndicatorCounted(); int limit; limit=BarsCalculated-counted_bars;
Вроде рисует....
//+------------------------------------------------------------------+ //| trend_v3.mq5 | //| Copyright 2010, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2010, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 Blue input int period =20; double A[]; //+-------------- //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,A, INDICATOR_DATA); ArraySetAsSeries(A,true); //--- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime& time[], const double& open[], const double& high[], const double& low[], const double& close[], const long& tick_volume[], const long& volume[], const int& spread[]) { //int counted_bars=IndicatorCounted(); int i, j, k, q, limit; double X[4][4], Y[4], B[4], x[4][2000], y[2000], a; int Bar=Bars("EURUSD",PERIOD_D1); ArraySetAsSeries(close,true); // limit=BarsCalculated-counted_bars; for(q=0; q<Bar; q++) { ArrayInitialize(X,0); ArrayInitialize(Y,0); ArrayInitialize(B,0); ArrayInitialize(x,0); ArrayInitialize(y,0); //=========================================== for (i=0; i<=period; i++) { x[0][i]=1; x[1][i]=i+q; y[i]= close[i+q]; } //=========================================== for (k=1; k<=period; k++) { for (j=0; j<=1; j++) { for (i=0; i<=1; i++) { X[i][j]=x[j][k]*x[i][k]+X[i][j]; } Y[j]=y[k]*x[j][k]+Y[j]; }} //=========================================== k=0; j=1; a=X[k][j]/X[k][k]; for (i=0; i<=3; i++){ X[i][j]=X[i][j]-X[i][k]*a; } Y[j]=Y[j]-Y[k]*a; //========================================== for (k=2; k>=1; k--){ a=0; for (i=1; i>=k; i--){ a=X[i][k-1]*B[i]+a; } B[k-1]=(Y[k-1]-a)/X[k-1][k-1]; } //========================================= A[q]=B[0]+B[1]*q; } //--- //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
gumgum:
Вроде рисует....
Большое спасибо! не подскажите, почему 4-ки появились в массиве?
double X[4][4], Y[4], B[4], x[4][2000]
в mql4 нормально индикатор работал
m_a_sim:
Большое спасибо! не подскажите, почему 4-ки появились в массиве?
в mql4 нормально индикатор работал
for (i=0; i<=3; i++){ X[i][j]=X[i][j]-X[i][k]*a; }
Если оставить двойки будет выхот за пределы массива в mql5 теперь это ошибка "2010.08.27 13:05:47 xxxx.mql5(EURJPY,H1) Array out of range in 'xxxx.mql5' (84,3)"
Сижу, пытаюсь разобраться с написанием советника на mql5. Mного нервотрепок, как-будто знания mql4 вообще не требовались. Я не уверен, но мне кажется, что разработчики перегнули палку.
вроде бы начало продвигаться потихоньку.
Не подскажите, какой функцией закрывается открытая позиция?
m_a_sim:
вроде бы начало продвигаться потихоньку.
Не подскажите, какой функцией закрывается открытая позиция?
Михаил, может на другой форум перейти, на пятый.
спасибо за совет))
Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
Доброе время суток!
Решил переделать свой индикатор с MQL4 в MQL5
Может опытный глаз экспертов определит в чем проблема,почему не работает, хотябы с оформлением самого индикатора?