With a sliding counting algorithm, only two DBL_MAX prices are needed at the beginning to make the entire buffer become INF
DBL_MAX + DBL_MAX = INF
and then INF will no longer escape from the calculations
This variant is quite probable because it is DBL_MAX that is filled with values below the MAA period. Then there is a bug in the recurrent algorithm average - MODE_SMA.
It is so! I made some changes and it works!
// Вычисляем Машку от Машки через хэндл самого себя#property indicator_separate_window#property indicator_buffers1#property indicator_plots1#property indicator_type1 DRAW_LINE#property indicator_color1 clrRed#property indicator_style1 STYLE_SOLID#property indicator_width1 1inputbool CustomData = false; // true - кастомный режим для iCustominputint MAPeriod = 1 e1; // Период МАшкиstring GetMyName( void )
{
constint Length = StringLen(TerminalInfoString(TERMINAL_DATA_PATH) + "\\MQL5\\Indicators\\");
conststring Path = MQLInfoString(MQL_PROGRAM_PATH);
return(StringSubstr(Path, Length, StringLen(Path) - Length - 4));
}
double Buffer[];
constbool Init = SetIndexBuffer(0, Buffer, INDICATOR_DATA);
constint handleMA = CustomData ? iMA(NULL, PERIOD_CURRENT, 100, 0, MODE_SMA, PRICE_OPEN) // от этой МАшки будет брать другую Машку, но не напрямую, а кастомно
: iMA(NULL, PERIOD_CURRENT, MAPeriod, 0, MODE_SMA, iCustom(_Symbol, PERIOD_CURRENT, GetMyName(), true));
int Replace( double &Array[], constdouble NewValue = 1 e3, constdouble PrevValue = EMPTY_VALUE )
{
for (int i = ArraySize(Array) - 1; i >= 0; i--)
if (Array[i] == PrevValue)
Array[i] = NewValue;
return(0);
}intOnCalculate( constint rates_total, // размер входных таймсерий constint prev_calculated, // обработано баров на предыдущем вызовеconstdatetime& time[], // Time constdouble& open[], // Open constdouble& high[], // High constdouble& low[], // Low constdouble& close[], // Close constlong& tick_volume[], // Tick Volume constlong& volume[], // Real Volume constint& spread[] ) // Spread
{
return(prev_calculated + CopyBuffer(handleMA, 0, prev_calculated, rates_total - prev_calculated, Buffer) + Replace(Buffer));
}
One can state for sure that the recurrent algorithm iMA does not take into account the case when DBL_MAX is fed to the input. Bug.
Such constructs should be avoided. The order in which the operands are executed is not regulated in C++, so it's up to the individual compiler to decide. The exceptions are the && and || operators, where the operands are always executed left to right.
Such constructs should be avoided. The order in which the operands are executed in C++ is not regulated, so it's up to the individual compiler to decide. The exceptions are && and || operators, where the operands are always executed left to right.
Hello. Can you please tell me which functions can be used to get the list of indicators displayed on the chart and their parameters? I only found a function that returns the number of indicators on the chart
У каждого графика можно посмотреть списки наложенных объектов: индикаторов, аналитических объектов и советников. Там же можно можно редактировать их свойства и удалять их с графика. Список индикаторов Индикаторы сгруппированы на наложенные на основное окно графика и на те, что открыты в отдельных окнах. Выберите индикатор и нажмите "Свойства...
Hello. Can you please tell me which functions can be used to get the list of indicators displayed on the chart and their parameters? I only found the function that returns the number of indicators in the chart
Preprocessor directives setting in one line - will be turned off soon, though.
Execution of operands from left to right.
OrderSend is 99% synchronized with the trading environment.
ChartApplyTemplate is asynchronous.
And there are a lot of other undocumented subtleties. And then there are cases where the documentation does not correspond to reality. And this is not a bug, but a rare bug that simply isn't mentioned.
The precedent was a casting rejection, but there was a reason there.
So not using something just because it's not described is a questionable decision.
I think such code would not cause programmers' doubts.
int Replace( double &Array[], int );
return(prev_calculated + Replace(Buffer, CopyBuffer(handleMA, 0, prev_calculated, rates_total - prev_calculated, Buffer)));
However, it's not very nice. It makes sense to write MyCopyBuffer but it is ugly to show in a short code that you need it to avoid a bug. So using undocumented operand execution priority is just right to show that this is a temporary solution.
The entire CopyBuffer is INF there.
With a sliding counting algorithm, just two DBL_MAX prices are enough at the beginning to make the entire buffer become INF
DBL_MAX + DBL_MAX = INF
and then INF will not leave the calculation
You should change the code of all indicators to ignore EMPTY_VALUEWith a sliding counting algorithm, only two DBL_MAX prices are needed at the beginning to make the entire buffer become INF
DBL_MAX + DBL_MAX = INF
and then INF will no longer escape from the calculations
This variant is quite probable because it is DBL_MAX that is filled with values below the MAA period. Then there is a bug in the recurrent algorithm average - MODE_SMA.
It is so! I made some changes and it works!
One can state for sure that the recurrent algorithm iMA does not take into account the case when DBL_MAX is fed to the input. Bug.
@A100, Thanks!
MetaEditor hangs when trying to compile an attached file
If it does not hang right away, wait a while or go to the summary line and see the compilation time
Why not show the order/transaction number in a pop-up window when hovering with the mouse? Asked for it a thousand years ago, it's so lacking!
Such constructs should be avoided. The order in which the operands are executed is not regulated in C++, so it's up to the individual compiler to decide. The exceptions are the && and || operators, where the operands are always executed left to right.
Such constructs should be avoided. The order in which the operands are executed in C++ is not regulated, so it's up to the individual compiler to decide. The exceptions are && and || operators, where the operands are always executed left to right.
Well, we are in MQL!
Well, we're in MQL!
Nowhere in the documentation does it say anything specific about any particular order. So they can change it as they see fit at any time.
I've already contacted service-desk once to clarify this issue.
Hello. Can you please tell me which functions can be used to get the list of indicators displayed on the chart and their parameters? I only found a function that returns the number of indicators on the chart
Hello. Can you please tell me which functions can be used to get the list of indicators displayed on the chart and their parameters? I only found the function that returns the number of indicators in the chart
IndicatorParameters (+ IndicatorRelease)
Nowhere in the documentation does it say anything specific about any particular order. So they can change it as they see fit at any time.
I don't bother with that. There's a lot of things that aren't described there.
Off the top of my head
The precedent was a casting rejection, but there was a reason there.
So not using something just because it's not described is a questionable decision.
I think such code would not cause programmers' doubts.
However, it's not very nice. It makes sense to write MyCopyBuffer but it is ugly to show in a short code that you need it to avoid a bug. So using undocumented operand execution priority is just right to show that this is a temporary solution.