Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 602

 
Expert:


Yes, it's understandable. I attached my log. It turns out that when I reach the end of 20000 bar to 0, it's as if it starts the whole 20000 bar again. That is, it either does not complete OnCalculate, or returns zero instead of rates_total.

But for some reason this bug hasn't affected you. It works fine for you...

So I can't figure out what's wrong with my machine/system?

Try reducing the nested cycles by a factor of 100 first and then add more. That way you'll know if your i5 can't handle it or if MT is slowing down.

Did you notice that I reduced one nested loop by a factor of 10? It took me 2 minutes and 12 seconds to recalculate like that.

You can in this line

limit = (prev_calculated > 0)?rates_total-prev_calculated:rates_total-100;

100 increase. This will give a reduction in the recalculated bars when the indicator starts.



 

Good evening (night, morning, afternoon) to all!

Can you please tell me how to code the following condition.

If High[1]......High[300].(all exceptions) < Open[0].

Open an order.

Thank you.

 
solnce600:

Good evening (night, morning, afternoon) to all!

Can you please tell me how to code the following condition.

If High[1]......High[300].(all exceptions) < Open[0].

Open an order.

Thank you.


As an option:

int index=iHighest(NULL,0,MODE_HIGH,300,1);
if(High[index]<Open[0])
  {
   //открываем ордер
  }
 
isn-88:


As an option:

Thank you.
 
I can't find which function in the EA allows me to look into the future. The thing is, the EA opens positions at a certain time, and there are a great many holes, looking for ways to get around such a thing.
 
001:
I can't find which function in the EA allows me to look into the future. The thing is, the EA opens positions at a certain time, and there are a great many holes, looking for ways to get around such a thing.

You don't need to look into the future but into the past, just check for holes and that's it.
 
001:
I can't find which function in the EA allows me to look into the future. The thing is, the EA opens positions at a certain time, and there are a lot of holes, looking for ways to get around such a thing.
Which holes are you talking about? When you ask questions about programming, such expressions are not appropriate, holes are gaps in the historical data for a symbol, and what do you mean here? If "time" is in the question, you probably meant "time travel holes" teleportation.
If I have any telepathic powers, I just need to get a good history on the instrument.
 

Need help, colleagues.

I'm writing an EA (first-born) and it needs analysis of historical data to work correctly.

I am using arrays of opening prices, opening times of highs and lows.

When dividing the arrays into daily periods, I get different number of minute bars in almost every period. All 1440 min. bars are physically present in the chart, while the history shows 1380, 1378 or more than 3000 per day.

Please help me to understand what the problem is. In my opinion, the history cannot differ from the real (drawn) chart.

Here's a piece of code that calculates it all.

void CountStartTime(int i)//Собственно функция расчета времен, параметр - номер периода расчета

{

int my_by_tp, my_sell_tp, my_by_sl, my_sell_sl;

int j_v_t = my_period_array_start[i];//Смещение от начала расчетного периода

// Alert("Обсчет истории в ", i, " день");



do

{

//Устанавливаем пороги

double MyOpenPrise = my_open_array[j_v_t];

double MyByTakeProfit = MyOpenPrise + (TakeProfit + 5)*RealPoint;

double MySellTakeProfit = MyOpenPrise - (TakeProfit + 5)*RealPoint;

double MyByStopLoss = MyOpenPrise - (StopLoss - 5)*RealPoint;

double MySellStopLoss = MyOpenPrise + (StopLoss - 5)*RealPoint;



for ( my_by_tp = j_v_t; my_by_tp >= my_period_array_stop[i-1]; my_by_tp--)

{

if(my_max_array[my_by_tp] >= MyByTakeProfit) break;//Срабатывает при превышении уровня тейк-профита

}



for ( my_by_sl = j_v_t; my_by_sl >= my_period_array_stop[i-1]; my_by_sl--)

{

if(my_min_array[my_by_sl] <= MyByStopLoss) break;//Срабатывает при превышении уровня стоп-лоса

}



for ( my_sell_tp = j_v_t; my_sell_tp >= my_period_array_stop[i-1]; my_sell_tp--)

{

if(my_min_array[my_sell_tp] <= MySellTakeProfit) break;//Срабатывает при превышении уровня тейк-профита

}



for ( my_sell_sl = j_v_t; my_sell_sl >= my_period_array_stop[i-1]; my_sell_sl--)

{

if(my_max_array[my_sell_sl] >= MySellStopLoss) break;//Срабатывает при превышении уровня стоп-лоса

}



//А теперь проверка на наличие всех четырех точек

if(my_by_tp >= my_period_array_stop[i-1] && my_sell_tp >= my_period_array_stop[i-1] && my_by_sl <= my_by_tp && my_sell_sl <= my_sell_tp)

{

my_time_vvoda_array[TimeHour(my_time_array[j_v_t])][TimeMinute(my_time_array[j_v_t])][i-1] = 1;

}

j_v_t--;//отступаем на 1 тикет в сторону окончания периода расчета

}

while(j_v_t >= my_period_array_stop[i-1]);//и расчет точек по новой



Alert("дата первого бара ",TimeToString(my_time_array[my_period_array_start[i]],TIME_DATE),", Start - ",my_period_array_start[i],", дата последнего бара ",TimeToString(my_time_array[my_period_array_stop[i]],TIME_DATE),", Stop - ",my_period_array_stop[i]);

return;

}



void CountStartTimeFinal()//Собственно функция расчета времени на конце истории

{

int my_by_tp, my_sell_tp, my_by_sl, my_sell_sl;

int j_v_f = 2500;//Смещение от начала расчетного периода



do

{

//Устанавливаем пороги

double MyOpenPrise = my_open_array[j_v_f];

double MyByTakeProfit = MyOpenPrise + (TakeProfit + 5)*RealPoint;

double MySellTakeProfit = MyOpenPrise - (TakeProfit + 5)*RealPoint;

double MyByStopLoss = MyOpenPrise - (StopLoss - 5)*RealPoint;

double MySellStopLoss = MyOpenPrise + (StopLoss - 5)*RealPoint;



for ( my_by_tp = j_v_f; my_by_tp >= 1; my_by_tp--)

{

if(my_max_array[my_by_tp] >= MyByTakeProfit) break;//Срабатывает при превышении уровня тейк-профита

}



for ( my_by_sl = j_v_f; my_by_sl >= 1; my_by_sl--)

{

if(my_min_array[my_by_sl] <= MyByStopLoss) break;//Срабатывает при превышении уровня стоп-лоса

}



for ( my_sell_tp = j_v_f; my_sell_tp >= 1; my_sell_tp--)

{

if(my_min_array[my_sell_tp] <= MySellTakeProfit) break;//Срабатывает при превышении уровня тейк-профита

}



for ( my_sell_sl = j_v_f; my_sell_sl >= 1; my_sell_sl--)

{

if(my_max_array[my_sell_sl] >= MySellStopLoss) break;//Срабатывает при превышении уровня стоп-лоса

}



//А теперь проверка на наличие всех четырех точек

if(my_by_tp > 1 && my_sell_tp > 1 && my_by_sl <= my_by_tp && my_sell_sl <= my_sell_tp)

{

my_time_vvoda_final[TimeHour(my_time_array[j_v_f])*60 + TimeMinute(my_time_array[j_v_f])] = 1;

}

j_v_f--;//отступаем на 1 тикет в сторону окончания периода расчета

}

while(j_v_f >= 1);//и расчет точек по новой



return;

}



void tochka_vvoda ()

{

if(AutoCountTime == true)

{

int i, j_v, k_v = 0, l = 0, m, n, a_i = 0;

PointCount();//Считаем значение пункта

for(i=0;i<=23;i++)//Обнуляем значения массивов

{

for(j_v=0;j_v<=59;j_v++)

{

for(k_v=0;k_v<=39;k_v++) my_time_vvoda_array[i][j_v][k_v] = 0;//Итоговый массив по суткам

my_time_vvoda_start[60*i + j_v] = 0;//Итоговый суточный массив дальней истории

my_time_vvoda_final[60*i + j_v] = 0;//Итоговый суточный массив ближайшей истории

my_time_vvoda_count[60*i + j_v] = 0;//Итоговый массив

}

}



k_v = 0;

j_v = 0;

m = 0;

n = 0;

bool srt = false;



Alert("");

Alert("");

Alert("");



datetime StartTime;//Время начала периода расчета

StartTime = StrToTime(StartBarTime); // текущая дата + время

datetime EndTime;//Время конца периода расчета

EndTime = StrToTime(FinishBarTime); // текущая дата + время



k_v = 1;

for(i=0;i<=49999;i++)//Чтение истории на минутном графике и запись ее по массивам

{

while(iTime(Symbol(),1,k_v) == 0) k_v++;

my_open_array[i] = iOpen(Symbol(),1,k_v);//Массив цен открытия

my_max_array[i] = iHigh(Symbol(),1,k_v);//Массим максимумов

my_min_array[i] = iLow(Symbol(),1,k_v);//Массив минимумов

my_time_array[i] = iTime(Symbol(),1,k_v);//Массив времен открытия

k_v++;

if((j_v <= i) && srt == false && (TimeHour(my_time_array[i]) == TimeHour(EndTime)) && (TimeMinute(my_time_array[i]) == TimeMinute(EndTime)))

{

j_v = i + 10;

srt = true;

if(a_i < 40) my_period_array_stop[a_i] = i;//Массив тикетов окончания расчетного периода, разделенный по дням

}

if((j_v <= i)&& srt == true && (TimeHour(my_time_array[i]) == TimeHour(StartTime)) && (TimeMinute(my_time_array[i]) == TimeMinute(StartTime)))

{

j_v = i;

srt = false;

if(a_i < 40) my_period_array_start[a_i] = i;//Массив тикетов начал расчетного периода, разделенный по дням

a_i++;

}

if(k_v >= iBars(Symbol(),1)) break;

}



Alert("Величина истории (iBars) = ",iBars(Symbol(),1), " баров");

Alert("Для расчета можно использовать ",a_i, " периодов");

if(a_i == 0)

{

MessageBox("Расчет истории не возможен","ВНИМАНИЕ",0x00000030);

return;

}



//Вызов функции обсчета истории по дням

if(a_i < VelichinaIstorii) MyHistiryLoss = true;

else MyHistiryLoss = false;

for(day_id = VelichinaIstorii; day_id >= 1; day_id--) CountStartTime(day_id);



for(i=0;i<=23;i++)

{

for(j_v=0;j_v<=59;j_v++)

{

k_v=0;

for(day_id = VelichinaIstorii - 1; day_id >= 0; day_id--)

{

k_v = k_v + my_time_vvoda_array[i][j_v][day_id];

}

if(k_v == VelichinaIstorii - 1) my_time_vvoda_start[60*i + j_v] = 1;//Alert("Полное совпадение в ", i," часов ", j," минут");

}

}



CountStartTimeFinal();//Вызов функции обсчета ближайшей истории



m = 0;

n = 0;

for(i=0;i<=1439;i++)

{

if(my_time_vvoda_start[i] == 1 && my_time_vvoda_final[i] == 1)

{

if( m == 0) m = i;

n++;

}

else

{

if(m != 0 && n != 0) my_time_vvoda_count[m] = n;

m = 0;

n = 0;

}

}



if(m != 0 && n != 0) my_time_vvoda_count[m] = n;

if(MyHistiryLoss != true)

{

k_v = ArrayMaximum(my_time_vvoda_count,WHOLE_ARRAY,0);

l = k_v + MathFloor(my_time_vvoda_count[k_v]/2);

if(my_time_vvoda_count[k_v] != 0)

{

Alert("Максималиное совпадение с ",MathFloor(k_v/60)," часов ",MathMod(k_v, 60)," минут",", длительностью ",my_time_vvoda_count[k_v]," минут");

StartSessionTime = DoubleToStr(MathFloor(l/60),0) + ":" + DoubleToStr(MathMod(l, 60),0);

l = l + MathFloor(my_time_vvoda_count[k_v]/2);

EndSessionTime = DoubleToStr(MathFloor(l/60),0) + ":" + DoubleToStr(MathMod(l, 60),0);

Alert("Начало торговли в ",StartSessionTime);

}

else

{

Alert("Точка входа не найдена");

MyHistiryLoss = true;

}

}

else MessageBox("Расчет точки входа не возможен,\n нет достаточной истории","ВНИМАНИЕ",0x00000030);

}

else

{

Alert("Время торговли устанавливается в ручном режиме");

MyHistiryLoss = false;

}

return;

}
 
AlexeyVik:
What holes are you talking about? When you ask a question about programming, such expressions are not appropriate, holes are gaps in the historical data of the tool, but what do you mean here? If "time" is in the question, you probably meant "time travel holes" teleportation.
If I have any telepathic powers, I just need to get a good history on the instrument.

About holes in history, of course. And a question for you too: how do you achieve a quality story on an instrument?
 
001:

About holes in the story, of course. A question for you too: how do you achieve a quality story on an instrument?

There are instructions on the ista forum. The author, if I remember correctly, is Onna.

Yes it is. I have it saved in my bookmarks , only not insta, but robo.

But I don't know how it will be now with the new MT, the format has changed.