Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 488
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Can you tell me if I need any code in the Expert Advisor to run in the strategy tester in optimisation mode?
I'm trying to optimise my Expert Advisor, but I don't know what it is:
2014.02.18 21:54:30.386 Tester: cache file "C:\...\tester\caches\test.NZDUSD5.0" found and can be used for further optimization
We have history. NZDUSD5_0.fxt file weighs about 150 meters.
You can also see this in the tester's logs
2014.02.18 22:50:21.251 TestGenerator: unmatched data error (volume limit 305 at 2014.02.12 13:35 exceeded)
What's this about?
Help please!
Each of the variables can take a value from 1 to 5...Tell me how not to write 3125 options)))
Help please!
Each of the variables can take a value from 1 to 5...Tell me how not to write 3125 options)))
Draw 25 options and then deal with who is bigger afterwards.
Thanks... that's what I'm doing now... I wanted to do it with arrays, but I don't have the traction...))
Please help with indicator with ".mqh" attachments.
Indicator buffers ExtBuffer1[], ExtBuffer2[] and Buffer_M[] have size 0. At the same time buffer ExtBuffer0[] works fine and its size is equal to Bars, as it should be. The most interesting thing is that it worked fine in the old version of MT4 before it was updated to the new one. One more thing. If I move all elements of an indicator to the same basic mq4 file, everything works fine again.
Question: Why do the array sizes for indicator buffers in attachments get reset to 0?
Here is the source code of the indicator.
//+------------------------------------------------------------------+
//| AO_EMA_(with_includes).mq4 |
//+------------------------------------------------------------------+
#include <AO_EMA_(with_includes)_GLOB.mqh>
//--------------------------------------------
int init()
{
#include <AO_EMA_(with_includes)_INIT.mqh>
return(0);
}
//--------------------------------------------
int start()
{
#include <AO_EMA_(with_includes)_START.mqh>
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| AO_EMA_(with_includes)_GLOB.mq4 |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Black
#property indicator_color2 Green
#property indicator_color3 Red
//---- Input Data
extern int Slow = 100;
extern double Slow_Fast = 4.318;
extern int Average = 25; // Усреднение АО
extern bool Show_AO_G = true,
Show_AO_R = true;
//---- Глобальные переменные
int Fast;
bool Alert_done = false; // Флаг говорит о том, что Alert уже был раз сгенерирован.
//---- indicator buffers
double ExtBuffer0[];
double ExtBuffer1[];
double ExtBuffer2[];
//---- Буфера индикатора, для промежуточных расчетов
double Buffer_M[];
//+------------------------------------------------------------------+
//| AO_EMA_(with_includes)_INIT.mq4 |
//+------------------------------------------------------------------+
//---- Установка значение для переменной "Fast"
Fast = NormalizeDouble(Slow / Slow_Fast, 0);
//---- indicator buffers mapping
SetIndexBuffer(0, ExtBuffer0);
SetIndexBuffer(1, ExtBuffer1);
SetIndexBuffer(2, ExtBuffer2);
SetIndexBuffer(3, Buffer_M);
//---- drawing settings
SetIndexStyle(0, DRAW_NONE); // Линия не рисуется
SetIndexStyle(1, DRAW_HISTOGRAM); // Гистограмма
SetIndexStyle(2, DRAW_HISTOGRAM); // Гистограмма
SetIndexStyle(3, DRAW_NONE); // Линия не рисуется
//---- drawing begin settings
SetIndexDrawBegin(0, Fast); // Индикатор начинает рисоваться с этого бара, от начала графика слева.
SetIndexDrawBegin(1, Fast);
SetIndexDrawBegin(2, Slow);
SetIndexDrawBegin(3, Slow);
IndicatorDigits(Digits+1);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("AO_EMA ("+Fast+"-"+Slow+")");
SetIndexLabel(1,"Green");
SetIndexLabel(2,"Red");
//---- Обнуляем буфер индикатора
SetIndexEmptyValue(0, 0.0); SetIndexEmptyValue(1, 0.0);
SetIndexEmptyValue(2, 0.0); SetIndexEmptyValue(3, 0.0);
//---- initialization done
//+------------------------------------------------------------------+
//| AO_EMA_(with_includes)_START.mq4 |
//+------------------------------------------------------------------+
int limit, pos;
int counted_bars=IndicatorCounted();
double prev,current, pr;
bool up;
//---- Последний посчитанный бар будет пересчитан
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
Print("counted_bars=",counted_bars," Bars=",Bars," limit=",limit);
Print("0=",ArraySize(ExtBuffer0)," 1=",ArraySize(ExtBuffer1)," 2=",ArraySize(ExtBuffer2)," M=",ArraySize(Buffer_M));
//---- Расчет MACD для Гистограммы "= EMA(fast) - EMA(slow)"
if(Show_AO_G == true || Show_AO_R == true)
{ for(int i=0; i<limit; i++)
Buffer_M[i]=iMA(NULL,0,Fast,0,MODE_EMA,PRICE_MEDIAN,i)-iMA(NULL,0,Slow,0,MODE_EMA,PRICE_MEDIAN,i);
//---- Усредняем MACD по "Average".Это и будет рисоваться на графике..
//---- ... можно заменить на " EMA(Fast)".
pr=2.0/(Average+1);
pos=Bars-2;
if(counted_bars>2) pos=Bars-counted_bars-1;
//---- Основной расчет
while(pos>=0)
{ if(pos==Bars-2) ExtBuffer0[pos+1]=Buffer_M[pos+1];
ExtBuffer0[pos]=Buffer_M[pos]*pr+ExtBuffer0[pos+1]*(1-pr);
pos--; }
//---- Расперделение данных между 2-я буферами, для разделения по цветам
for(i=limit-1; i>=0; i--)
{ // При перерасчете самого левого бара, порядковый номер в массиве [i+1] выходит за пределы размера массива, поэтому расчет первого цикла прорускаем.
if(i == Bars-1) continue;
//------------------------------------
current = ExtBuffer0[i];
prev = ExtBuffer0[i+1];
if(current == prev) continue;
else
{ if(current>prev) up=true;
if(current<prev) up=false;
if(!up)
{ ExtBuffer2[i]=current;
ExtBuffer1[i]=0.0; }
else
{ ExtBuffer1[i]=current;
ExtBuffer2[i]=0.0; }
}}}
//--- Устанавливаем видимость индикаторов
if(Show_AO_G == false) SetIndexStyle(1, DRAW_NONE);
if(Show_AO_R == false) SetIndexStyle(2, DRAW_NONE);
Please help with indicator with ".mqh" attachments.
Indicator buffers ExtBuffer1[], ExtBuffer2[] and Buffer_M[] have size 0. At the same time buffer ExtBuffer0[] works fine and its size is equal to Bars, as it should be. The most interesting thing is that it worked fine in the old version of MT4 before it was updated to the new one. One more thing. If I move all elements of an indicator to the same basic mq4 file, everything works fine again.
Question: Why do the array sizes for indicator buffers in the attachments get reset to 0?
Here is the source code of the indicator.
Do you like to do things up your arse?
Gone to a woman.
:-) bravo!