Can this lead to errors or is it just a recommendation for coding culture?
No one forbids to use vinaigrette, BUT: won't you confuse yourself with variable names over time, won't you remember whether you updated or didn't update data in the variable?
No one forbids the use of a vinaigrette, BUT: won't you confuse yourself with variable names over time and remember whether or not you updated the data in the variable?
Thanks for the illustrative answers. But there are questions...
1. What does ? and : Found only :: context.
int count=(InpBarTime<10)?10:InpBarTime+1;
2. Which entry element defines the [h] entry in MT4
//--- example 1// if(Period()<=PERIOD_H4 && TimeHour(Time[h])==0 && TimeMinute(Time[h])==0)MqlDateTime SDateTime;
TimeToStruct(rates[InpBarTime].time,SDateTime); // Converts a value of datetime type into a structure variable MqlDateTimeif(Period()<=PERIOD_H4 && SDateTime.hour==0 && SDateTime.min==0)
{
}
Thanks for the illustrative answers. But there are questions...
1. What does it mean ? and : Found only :: context
int count=(InpBarTime<10)?10:InpBarTime+1;
-->
This is an abbreviated form. All the same:
int count=0;
if(InpBarTime<10)
count=10;
else
count=InpBarTime+1;
2. Which entry element defines the [h] entry in MT4
//--- example 1// if(Period()<=PERIOD_H4 && TimeHour(Time[h])==0 && TimeMinute(Time[h])==0)MqlDateTime SDateTime;
TimeToStruct(rates[InpBarTime].time,SDateTime); // Converts a value of datetime type into a structure variable MqlDateTimeif(Period()<=PERIOD_H4 && SDateTime.hour==0 && SDateTime.min==0)
{
}
В качестве первого операнда – "выражение1" – может быть использовано любое выражение, результатом которого является значение типа bool. Если результат равен , то выполняется третий операнд – "выражениеЗ". Второй и третий операнды, то есть "выражение2" и "выражениеЗ", должны возвращать значения одного типа и не должны иметь тип void...
Thanks for the illustrative answers. But there are questions...
1. What does it mean ? and : Found only :: context
-->
This is an abbreviated form. All the same:
2. Which entry element defines the [h] entry in MT4
-->
I think InpBarTime. What do you think?
I hardly think at the moment, in the usual sense of that state.... I'm BLONDING with a jack in the hand)))
You have globally declaredInpBarTime=3; And in MT4 [h] is from here to there usually in a loop (for limit ......)
#property script_show_inputs//--- input parametersint InpBarTime=3; // Bar where we compare the time//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
Found the Market_Sessions Indicator There's an interesting design there.... Trying to get the rest of the internal dialogue in my head into it...))))
I'm hardly thinking now, in the usual sense of the term.... I'm blonde with a jack in the hand)))
And you wrote globally like this
Found the Market_Sessions Indicator There's an interesting construction there.... Trying to get the rest of the internal dialogue in my head into it...))))
Ah, sorry, should have written it that way:
//--- input parametersinputint InpBarTime=3; // Bar where we compare the time
this operator has become fashionable lately, more and more often used
OK !!!
Did I get it right ?
//if(Period()<=PERIOD_H4 && TimeHour(Time[h])==0 && TimeMinute(Time[h])==0)MqlDateTime SDateTime;
TimeToStruct(rates[InpBarTime].time,SDateTime); // Converts a value of datetime type into a structure variable MqlDateTimeif(Period()<=PERIOD_H4 && SDateTime.hour==0 && SDateTime.min==0)
{
}
// А ЕСЛИ ПО ЦИКЛУ ?
int InpBarTime=10;
for(int a=0; a<=InpBarTime; a++)
{
//if(Period()<=PERIOD_H4 && TimeHour(Time[h])==0 && TimeMinute(Time[h])==0)MqlDateTime SDateTime;
TimeToStruct(rates[InpBarTime].time,SDateTime); // Converts a value of datetime type into a structure variable MqlDateTimeif(Period()<=PERIOD_H4 && SDateTime.hour==0 && SDateTime.min==0)
{
}
Запустив InpBarTime по циклу будем иметь цикл, но в структуре. Правильно?
Better not to be confused and use one approach: either trade classCSymbolInfo or system functions like SymbolInfoXXXX.
Yes, thank you. Can I also clarify.
Can it lead to errors or is it just a recommendation for coding culture?
Uh-huh, thank you. can I also clarify.
Can this lead to errors or is it just a recommendation for coding culture?
No one forbids to use vinaigrette, BUT: won't you confuse yourself with variable names over time, won't you remember whether you updated or didn't update data in the variable?
No one forbids the use of a vinaigrette, BUT: won't you confuse yourself with variable names over time and remember whether or not you updated the data in the variable?
Thank you, I see)
If you need to compare several timeseries of the same timeframe, work with an array ofMqlRates type-> and useCopyRates to fill this array.
It is convenient to store time in aMqlDateTime structure -> useTimeToStruct to convert time fromdatetime toMqlDateTime structure.
Now your example 1 will look like this:
Thanks for the illustrative answers. But there are questions...
1. What does ? and : Found only :: context.
2. Which entry element defines the [h] entry in MT4
Thanks for the illustrative answers. But there are questions...
1. What does it mean ? and : Found only :: context
-->
This is an abbreviated form. All the same:
2. Which entry element defines the [h] entry in MT4
-->
I think InpBarTime. What do you think?
What do you mean ? and : Found only :: context
https://www.mql5.com/ru/docs/basis/operators/ternary
this operator has become fashionable lately, it is being used more and more often
kopeyka2:
Thanks for the illustrative answers. But there are questions...
1. What does it mean ? and : Found only :: context
-->
This is an abbreviated form. All the same:
2. Which entry element defines the [h] entry in MT4
-->
I think InpBarTime. What do you think?
I hardly think at the moment, in the usual sense of that state.... I'm BLONDING with a jack in the hand)))
You have globally declaredInpBarTime=3; And in MT4 [h] is from here to there usually in a loop (for limit ......)
#property script_show_inputs //--- input parameters int InpBarTime=3; // Bar where we compare the time //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart()Found the Market_Sessions Indicator There's an interesting design there.... Trying to get the rest of the internal dialogue in my head into it...))))
I'm hardly thinking now, in the usual sense of the term.... I'm blonde with a jack in the hand)))
And you wrote globally like this
Found the Market_Sessions Indicator There's an interesting construction there.... Trying to get the rest of the internal dialogue in my head into it...))))
Ah, sorry, should have written it that way:
What do you mean ? and : Found only :: context
https://www.mql5.com/ru/docs/basis/operators/ternary
this operator has become fashionable lately, more and more often used
OK !!!
Did I get it right ?
OK !!!
Did I get it right?
You haven't got it right. I gave you a working example. Run it. Forget the MQL4 style writing. Start studying the code and look at the help.