1. now look at the screen resolution and scale. I don't know how to do this on 8.1, I'm on 10 myself at the moment. You clearly have all the controls displaced. It's typical when you write a program for a standard scale, and the user usually sets it to a larger scale. You don't have a notebook with a small screen there, do you? They usually zoom in because it's hard to see small elements.
There is indicator code. It counts and draws asc and bid lines + counts average speed X of fresh Num_Aver_of_Ticks ticks received in Sec_at_Num_Aver_of_Ticks seconds. X = Num_Aver_of_Ticks / (time_s - ExtMapBuffer3[Num_Aver_of_Ticks]);
How do I read the value of this variable X (see end of start function) in the EA?
//+------------------------------------------------------------------//////////+------------------------------------------------------------------#property copyright"ROMANBEST"#property link"rshiredchenko@mail.ru"#property indicator_separate_window#property indicator_buffers2#property indicator_color1 clrLimeGreen#property indicator_color2 clrBlue// Цвет второй линии//#property indicator_color3 clrGray // Цвет третьей линии - гистограммы//---- buffersexternint MaxDrawTicks=100;
externint Num_Aver_of_Ticks=15;
//--- Создаём динамические массивыdouble ExtMapBuffer1[]; // Индикаторный массив значений цен Biddouble ExtMapBuffer2[]; // Индикаторный массив значений цен Ask // Кол-во тиков для среднего Num_Aver_of_Ticks / кол-во секунд, за которое эти тики поступили // При обращении к любому члену массива по индексу (допустим i) нужно убедиться что i>=0 и i<ArraySize(High) double ExtMapBuffer3[]; // Массив значений времени в сек. с момента запуска индикатора
int size; // Вспомогательная переменная для массива// При обращении к любому члену массива по индексу (допустим i) нужно убедиться что i>=0 и i<ArraySize(High) int myBars;
int i;
int delimeterCounter;
int _start,tickCounter;
double Sec_at_Num_Aver_of_Ticks; // кол-во секунд, за которое поступило среднее количество тиков для расчёта // (Num_Aver_of_Ticks)//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int init()
{
//---- indicatorsSetIndexBuffer(0, ExtMapBuffer1); // Назначение массива буферуSetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2); // Стиль линии SetIndexEmptyValue(0,0.0);
SetIndexBuffer(1, ExtMapBuffer2); // Назначение массива буферуSetIndexStyle (1,DRAW_LINE,STYLE_SOLID,2); // Стиль линии SetIndexEmptyValue(1,0.0);
//--- устанавливаем размер динамического массиваif(ArrayResize(ExtMapBuffer3,MaxDrawTicks)<0) {Print(" Ошибка в изменении размера массива времени поступления тиков "); return(false);}
//--- установим индексацию для буфера как в таймсерии для динамического массива// ArraySetAsSeries(ExtMapBuffer3,true);//--- Возвращает количество элементов указанного массива.
size=ArraySize(ExtMapBuffer3);
if (size>0) Print("Размер массива: ",size);
elsePrint("Ошибка. Массив пустой ",size);
// for(int i=0;i<=100;i++) Print(" ExtMapBuffer3[i] = ", ExtMapBuffer3[i]); //--- заполняем начальные 50 элементов значением 4// ArrayFill(ExtMapBuffer3,0,50,4);//--- заполняем 50 элементов (начиная с 50-го) значением 8// ArrayFill(ExtMapBuffer3,50,50,8);//--- выводим значения всех элементов// for(int i=0;i<ArraySize(ExtMapBuffer3);i++) Print(" i = ", i, " ExtMapBuffer3 = ", ExtMapBuffer3[i]); // ------------Print("Обнуляем тики и время их поступления");
for (i=Bars-1;i>=0;i--) { ExtMapBuffer1[i]=0.0; ExtMapBuffer2[i]=0.0; ExtMapBuffer3[i]=0.0;}
//--- запомним начальное значение для подсчёта секунд c момента старта системы
_start = GetTickCount();
//----return(0);
}
//+------------------------------------------------------------------+//| Custom indicator deinitialization function |//+------------------------------------------------------------------+int deinit()
{
//----//----return(0);
}
//+------------------------------------------------------------------+//| сдвинем массив |//+------------------------------------------------------------------+void SetDelimeter()
{
//----string delimeterDate=TimeToStr(Time[0]);
if (myBars!=0)
{
Print("Ставим разделитель");
int handle=WindowFind("Ticks");
if(!ObjectCreate(delimeterDate,OBJ_VLINE,handle,Time[0],0))
{
Print("Неудачная попытка создания разделителя в окне ",
handle," по времени ",TimeToStr(CurTime()));
Print("Ошибка №",GetLastError(),", имя разделителя ",delimeterDate);
}
else
{
ObjectSet(delimeterDate,OBJPROP_COLOR,DarkGreen);
ObjectSet(delimeterDate,OBJPROP_STYLE,STYLE_DASHDOT);
ObjectsRedraw();
}
}
//----
}
//+------------------------------------------------------------------+//| сдвинем массив |//+------------------------------------------------------------------+void ShiftArray()
{
//----int V_lines;
string delimeterName;
datetime firstTime;
int BarFirstTime;
if (tickCounter>2*MaxDrawTicks)
{
for (i=tickCounter;i>=MaxDrawTicks;i--) { ExtMapBuffer1[i]=0.0; ExtMapBuffer2[i]=0.0; ExtMapBuffer3[i]=0.0; }
tickCounter=MaxDrawTicks;
}
for(int cnt=tickCounter;cnt>0;cnt--)
{
ExtMapBuffer1[cnt]=ExtMapBuffer1[cnt-1];
ExtMapBuffer2[cnt]=ExtMapBuffer2[cnt-1];
ExtMapBuffer3[cnt]=ExtMapBuffer3[cnt-1];
}
V_lines=ObjectsTotal();
for (int z=0;z<V_lines;z++)
{
delimeterName=ObjectName(z);
if (ObjectFind(delimeterName)!=-1)
{
if (ObjectType(delimeterName)==OBJ_VLINE)
{
firstTime=ObjectGet(delimeterName,OBJPROP_TIME1);
BarFirstTime=iBarShift(NULL,0,firstTime);
firstTime=Time[BarFirstTime+1];
ObjectSet(delimeterName,OBJPROP_TIME1,firstTime);
}
}
}
//----
}
//+------------------------------------------------------------------+//| признак нового бара |//+------------------------------------------------------------------+bool isNewBar()
{
//----bool res=false;
if (myBars!=Bars)
{
res=true;
myBars=Bars;
}
//----return(res);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+int start()
{
//--- выводим значения всех элементов// for(int i=0;i<ArraySize(ExtMapBuffer3);i++) Print(" i = ", i, " ExtMapBuffer3 = ", ExtMapBuffer3[i]); //--- получим время в миллисекундах, прошедших с момента старта системы uint time_ms=GetTickCount() - _start;
//--- получим время в секундах, прошедших с момента старта системы double time_s=time_ms/1000;
double X; // вспомогательная переменная int counted_bars=IndicatorCounted();
//----if (isNewBar())
{
// установить разделитель//tickCounter++;
SetDelimeter();
ExtMapBuffer1[0]=Bid;
ExtMapBuffer2[0]=Ask;
//ExtMapBuffer3[0]= time_s; //--- заполняем c tickCounter элементов значением time_s// ArrayFill(ExtMapBuffer3,tickCounter,1,time_s); if (tickCounter >= 0 && tickCounter < ArraySize(ExtMapBuffer3) && tickCounter <= Num_Aver_of_Ticks)
{
//--- заполняем начальный и последующие элементы значениями time_sif (tickCounter == 0) ArrayFill(ExtMapBuffer3,0,1,time_s);
elseArrayFill(ExtMapBuffer3,tickCounter,1,time_s);
//--- выводим значение элементаfor( i=0;i<1;i++) Print(" tickCounter = ", tickCounter, " ExtMapBuffer3 = ", ExtMapBuffer3[tickCounter]);
}
}
else
{
tickCounter++;
ShiftArray();
ExtMapBuffer1[0]=Bid;
ExtMapBuffer2[0]=Ask;
ExtMapBuffer3[0]= time_s;
// массив // индекс начального элемента // количество элементов // значение, которым заполняется массив //--- заполняем начальные (с нуля) tickCounter элементов значением time_s//ArrayFill(ExtMapBuffer3,tickCounter,1,time_s); // X = tickCounter/time_s; if (tickCounter >= 0 && tickCounter < ArraySize(ExtMapBuffer3) && tickCounter <= Num_Aver_of_Ticks)
{
//--- заполняем начальный и последующие элементы значениями time_sif (tickCounter == 0) ArrayFill(ExtMapBuffer3,0,1,time_s);
elseArrayFill(ExtMapBuffer3,tickCounter,1,time_s);
//--- выводим значение элементаfor( i=0;i<1;i++) Print(" tickCounter = ", tickCounter, " ExtMapBuffer3 = ", ExtMapBuffer3[tickCounter]);
}
}
/*
if (tickCounter > Num_Aver_of_Ticks) то ищем индекс массива с минимумом http://docs.mql4.com/ru/array/arrayminimum и заполняем его значением секунд
следующего тика... Потом считаем разность между этим значением и следующим минимумом...
Псле заполнения массива до ExtMapBuffer3[Num_Aver_of_Ticks]. Читать минимум, максимум. Переписываем минимум. Разница значений
ExtMapBuffer3[максимум] и ExtMapBuffer3[минимум] будет время в секундах поступления Num_Aver_of_Ticks.
*/
Sec_at_Num_Aver_of_Ticks = time_s - ExtMapBuffer3[Num_Aver_of_Ticks];
if (tickCounter >= Num_Aver_of_Ticks && (time_s - ExtMapBuffer3[Num_Aver_of_Ticks])!=0)
X = Num_Aver_of_Ticks / (time_s - ExtMapBuffer3[Num_Aver_of_Ticks]);
if (time_s!=0)
Comment(
"tickCounter = ", tickCounter, "\n",
"secondCounter = ", NormalizeDouble(time_s,Digits) , "\n",
"ExtMapBuffer1[0] = ", NormalizeDouble(ExtMapBuffer1[0],Digits) , "\n",
"ExtMapBuffer2[0] = ", NormalizeDouble(ExtMapBuffer2[0],Digits) , "\n",
"ExtMapBuffer3[0] = ", NormalizeDouble(ExtMapBuffer3[0],Digits) , "\n",
"Average speed for average quantity of tics = ", NormalizeDouble(X,2), " Num_Aver_of_Ticks/Sec_at_Num_Aver_of_Ticks ", "\n",
"Num_Aver_of_Ticks = ", Num_Aver_of_Ticks," Время в секундах поступления Num_Aver_of_Ticks = ",Sec_at_Num_Aver_of_Ticks , "\n",
"Average speed since running = ", NormalizeDouble(tickCounter/time_s,Digits) , " All Tick/All Second ", "\n",
"") ;
//----return(0);
}
//+------------------------------------------------------------------+
there is indicator code. It counts and draws the asc and bid lines + counts the average rate X of fresh Num_Aver_of_Ticks ticks received per Sec_at_Num_Aver_of_Ticks seconds. X = Num_Aver_of_Ticks / (time_s - ExtMapBuffer3[Num_Aver_of_Ticks]);
How do I read the value of this variable X (see end of start function) in the EA?
It's hard to look at the code on the tablet, but the answer is to write the value of X into the buffer.
1. now look at the screen resolution and scale. I don't know how to do this on 8.1, I'm on 10 myself at the moment. You clearly have all the controls displaced. It's typical when you write a program for a standard scale, and the user usually sets it to a larger scale. You don't have a notebook with a small screen there, do you? They usually zoom in because it's hard to see small elements.
This is how it's set up on 10.
2. You have to set it to standard - 100%
1. I have a laptop with a "big" screen... :-)
2. So I did.
Thanks for the help...
1. I have a Notebook with a "big" screen... :-)
2. So I did.
Thanks for the help...
Thought about the resolution as well, while reading the question - got beaten to the answer.
You understand yourself - it's unrealistic to write a platform for all screens of any device)
I was thinking about the resolution too, when I read the question, you got ahead of me.
You know, it's impossible to write a platform for all screens of any device)
Sens... :-) Haven't been here in a while... Business... :-)
Same old faces. What's good!
Although you can't see many of them...
I was thinking about the resolution too, but when I read the question, the answer got ahead of me.
You understand yourself - it's unrealistic to write a platform for all screens of any device)
I can't remember and can't find in the documentation how to split the comment line of the EA parameters, in the window called by F7.
How to make it like in Excel ))
Everything works great!!!! It was not the algorithm. The issue is resolved.
Decided here by quadruplet:
There is indicator code. It counts and draws asc and bid lines + counts average speed X of fresh Num_Aver_of_Ticks ticks received in Sec_at_Num_Aver_of_Ticks seconds. X = Num_Aver_of_Ticks / (time_s - ExtMapBuffer3[Num_Aver_of_Ticks]);
How do I read the value of this variable X (see end of start function) in the EA?
Decided here by quadruplet:
there is indicator code. It counts and draws the asc and bid lines + counts the average rate X of fresh Num_Aver_of_Ticks ticks received per Sec_at_Num_Aver_of_Ticks seconds. X = Num_Aver_of_Ticks / (time_s - ExtMapBuffer3[Num_Aver_of_Ticks]);
How do I read the value of this variable X (see end of start function) in the EA?
It is difficult to look at code on the tablet, but the answer is inevitable - write value Х in the buffer.
Thank you. Artyom. The same goes for me... :-)
I wrote this indict long ago, and used Rosha's code from kodobase as a base.