Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 751

 
Aleksey Vyazmikin:

No, the article is about full-fledged management of optimizer from EA through ini file, and ini, I think, you can prescribe not only optimization but also any settings, it seems they are saved after the last start of tester in any mode. Then (in the EA code, you can) save the template and copy it to another terminal (from what I understood it is recommended to use the terminal for work of the tester and the EA). And after this procedure is finished call the template, where everything will be.

I haven't read that article.

 
Hello, just learning the basics, advise if there is a function or what is the easiest way to tell the Expert Advisor to work and check the conditions of the algorithm on a specific timeframe (say 5 min), say at the time of a new 5 min candle, not at every tick. Thanks
 
Hi all, who can tell me,
Is there a fibo with colour settings and adding lines outside the terminal manually or with autostretch, for MT4, MT5 if there is one please reset.
Many thanks in advance.
 
webpred:
Hello, i am just learning the basics, could you suggest a function or the easiest way to tell the Expert Advisor to work and check the algorithm conditions at a certain timeframe (say 5 min), say at the time of a new 5 min candle, and not at every tick. Thanks

there is an Expert Advisor Moving Average.mq4 in the terminal, and there are lines in it, try them (although many do otherwise)

//--- go trading only for first tiks of new bar
if(Volume[0]>1) return;

 

Good afternoon, I need advice on the iAO indicator. There is a difference in readings for iAO and values on the chart There is a shift by 2 bars. The zero bar may be assigned a value of 3, the first one may be assigned a value of 4. Why can it happen, but not all the time.


double aoH1[],aoH4[],aoD[];
ArrayResize(aoH1,6);
ArrayResize(aoH4,6);
ArrayResize(aoD,6);
for(int i=0; i<6; i++)
{
aoH1[i]=iAO(Symbol(),PERIOD_H1,i);
aoH4[i]=iAO(Symbol(),PERIOD_H4,i);
aoD[i]=iAO(Symbol(),PERIOD_D1,i);
// Alert(Symbol(), " H1(",i,")=",aoH1[i]," H4(",i,")=",aoH4[i]," D(",i,")=",aoD[i]);
}

 
germes_88:

Good afternoon, I need advice on the iAO indicator. There is a difference in readings for iAO and values on the chart There is a shift by 2 bars. The zero bar may be assigned a value of 3, the first one may be assigned a value of 4. Why can it happen, but not all the time.


double aoH1[],aoH4[],aoD[];
ArrayResize(aoH1,6);
ArrayResize(aoH4,6);
ArrayResize(aoD,6);
for(int i=0; i<6; i++)
{
aoH1[i]=iAO(Symbol(),PERIOD_H1,i);
aoH4[i]=iAO(Symbol(),PERIOD_H4,i);
aoD[i]=iAO(Symbol(),PERIOD_D1,i);
// Alert(Symbol(), " H1(",i,")=",aoH1[i]," H4(",i,")=",aoH4[i]," D(",i,")=",aoD[i]);
}

Because you are checking the indicator bars from a different timeframe than the current chart timeframe.

 
Konstantin Erin:

the terminal has an Expert Advisor Moving Average.mq4, and there are lines in it, try them (although many do otherwise)

//--- go trading only for first tiks of new bar
if(Volume[0]>1) return;

This is a wrong variant. The volume at the opening of a candle will not always equal 1, it may be equal to 2.
The right way is to use the time of zero candle.

datetime time_bar;
void OnTick() {
   if(time_bar != Time[0]) {
      time_bar = Time[0];
      // анализируем что либо на открытии свечи (закрытии свечи)
      }
   }
 
Artyom Trishkin:

Because you are checking the indicator bars from a different timeframe to the timeframe of the current chart.

But I need exactly different timeframes. Is there any way around this?
 
germes_88:
But it's the different timeframes that I want. Is there any way around that?

Well, you're getting the data. And you're getting it right. Only the minute bar #1 and the hour bar #1 will have completely different open times. Well, except for one time - when the opening time of a minute bar coincides with the opening time of an hour bar - once an hour.

 
Artyom Trishkin:

You can create a text ini file from which the indicator and EA will read data and use it as parameters forsetting the indicator. Then create a template with the EA and the indicator and manually or with a script to load this template on the chart.
We can simply draw the lines of the indicator in the Expert Advisor with graphical objects.
You can also invent something else.
You can ... You can either enter it manually or use MT5 where everything is possible :)


Artem, please advise on the best way to add or delete several indicators to a chart simultaneously.

I have tried to useChartIndicatorAdd/ChartIndicatorDelete scripts as a hotkey, but they do not allow to change the style.

Now there is an idea to write them as casts in one file, but maybe there is a better option?

Reason: