Hello, could you advise please, in the code below without the loop block (which comes after the CopyByffer), the indicator normally runs, but if you include a cycle comparing the price of a candle with the price of one of the bars, the bars themselves after the start are not displayed, what could be the problem?
#property indicator_chart_window#property indicator_buffers3#property indicator_plots3#property indicator_type1DRAW_LINE#property indicator_color1 Olive
#property indicator_type2DRAW_LINE#property indicator_color2 Green
#property indicator_type3DRAW_LINE#property indicator_color3 Olive
inputint peroid = 20; // период полос 1inputint bands_shift= 0; // смещение полос 1 inputdouble deviation = 2.3; // отклонение полос 1inputENUM_APPLIED_PRICE applied_price=PRICE_CLOSE; // тип цены double Base[]; // массив для BASE_LINE индикатора iBandsdouble Upper[]; // массив для UPPER_BAND индикатора iBandsdouble Lower[]; // массив для LOWER_BAND индикатора iBandsint iBands1_handle; //Указатель на первый индикатор int iBands2_handle; //Указатель на первый индикатор int g_i_Window;
intOnInit()
{
g_i_Window=ChartWindowFind();
SetIndexBuffer(0,Base,INDICATOR_DATA);
SetIndexBuffer(1,Upper,INDICATOR_DATA);
SetIndexBuffer(2,Lower,INDICATOR_DATA);
iBands1_handle=iBands(NULL,PERIOD_CURRENT,peroid,bands_shift,deviation,applied_price);
if(iBands1_handle==INVALID_HANDLE){
Alert("Неудалось загрузить индикатор, повторите попытку");
return(-1);
}
return(0);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+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
{
int i;
int shift = 0;
int shift1;
int shift2;
int shift3;
string alert;
double O, O1, O2, C, C1, C2, L, L1, L2, H, H1, H2;
shift1 = shift;
shift2 = shift + 1;
shift3 = shift + 2;
O = open[shift1];
O1 = open[shift2];
O2 = open[shift3];
H = high[shift1];
H1 = high[shift2];
H2 = high[shift3];
L = low[shift1];
L1 = low[shift2];
L2 = low[shift3];;
C = close[shift1];
C1 = close[shift2];
C2 = close[shift3];
i = (prev_calculated==0)?1: prev_calculated;
i = (prev_calculated==rates_total)?rates_total-1: i;
CopyBuffer(iBands1_handle,0,0,rates_total-1,Base);
CopyBuffer(iBands1_handle,1,0,rates_total-1,Upper);
CopyBuffer(iBands1_handle,2,0,rates_total-1,Lower);
for (i = i; i < rates_total; i++)
{
if(H > L && O > Lower[i])
{
int time_waiting = (int)TimeLocal() + 1;
while(TimeLocal() < time_waiting){}
Comment("True");
return(0);
}
elseComment("False");
}
if (prev_calculated==0) ChartRedraw();
return(rates_total);
}
In one situation I needed to make coloured bars or coloured candlesticks. They use 4 value buffers and 1 colour buffer. The other, I needed to display a coloured line, where 1 value buffer and 1 colour buffer.
Calling and changing indicator properties causes initialization of the indicator. Accordingly, if the settings contain bars or candlesticks, then one option of initialization. If the line, the other option of initialization.
It is impossible to change the number of buffers in the middle of the indicator, which is what Alexey Vyazmikin said without being aware of the other options.
In one situation I needed to make coloured bars or coloured candlesticks. They use 4 value buffers and 1 colour buffer. Another, I needed to display a coloured line, where 1 value buffer and 1 colour buffer.
Calling and changing indicator properties causes initialization of the indicator. Accordingly, if the settings contain bars or candlesticks, then one option of initialization. If a line, then another initialization option.
It is impossible to change the number of buffers in the middle of the indicator, which is what Alexey Vyazmikin said, without being aware of other options.
If you decide to write my last name in Russian, it sounds like Vyazmikin.
Regarding my suspicions - I think the answer is correct to the question posed. Without an explanation of needs there is no point in saying otherwise. Reinitialisation is a restart of the program, it is clear that you can change anything in the settings.
If you choose to write my surname in Russian, it sounds like Vyazmikin.
Regarding my suspicions - I believe the answer to the question posed is correct. Without an explanation of the needs, there is no point in saying otherwise. Reinitialisation is a restart of the program, it is clear that you can change anything in the settings.
Does the lack of a soft sign offend that much?
Did I talk about incorrectness, in my opinion I emphasised exactly the correctness of the answer.
I am driven by enlightenment, not offence. Why would I be offended, did you know how to spell and want to offend me? I didn't even consider that option, was it for nothing?
I am motivated by enlightenment, not resentment. Why should I be offended, did you know how to write correctly and want to offend me? I didn't even consider that option, was it for nothing?
Hello, could you advise please, in the code below without the loop block (which comes after the CopyByffer), the indicator normally runs, but if you include a cycle comparing the price of a candle with the price of one of the bars, the bars themselves after the start are not displayed, what could be the problem?
Result:
You can not.
Forum on trading, automated trading systems and trading strategy testing
Bugs, bugs, questions
Alexey Viktorov, 2018.05.30 15:53
Well, not quite so dynamically, but once through re-initialization you can. I did.
If you can elaborate, please describe
if you can be more specific
How much more detailed?
In one situation I needed to make coloured bars or coloured candlesticks. They use 4 value buffers and 1 colour buffer. The other, I needed to display a coloured line, where 1 value buffer and 1 colour buffer.
Calling and changing indicator properties causes initialization of the indicator. Accordingly, if the settings contain bars or candlesticks, then one option of initialization. If the line, the other option of initialization.
It is impossible to change the number of buffers in the middle of the indicator, which is what Alexey Vyazmikin said without being aware of the other options.
How much more detail?
In one situation I needed to make coloured bars or coloured candlesticks. They use 4 value buffers and 1 colour buffer. Another, I needed to display a coloured line, where 1 value buffer and 1 colour buffer.
Calling and changing indicator properties causes initialization of the indicator. Accordingly, if the settings contain bars or candlesticks, then one option of initialization. If a line, then another initialization option.
It is impossible to change the number of buffers in the middle of the indicator, which is what Alexey Vyazmikin said, without being aware of other options.
If you decide to write my last name in Russian, it sounds like Vyazmikin.
Regarding my suspicions - I think the answer is correct to the question posed. Without an explanation of needs there is no point in saying otherwise. Reinitialisation is a restart of the program, it is clear that you can change anything in the settings.
If you choose to write my surname in Russian, it sounds like Vyazmikin.
Regarding my suspicions - I believe the answer to the question posed is correct. Without an explanation of the needs, there is no point in saying otherwise. Reinitialisation is a restart of the program, it is clear that you can change anything in the settings.
Does the lack of a soft sign offend that much?
Did I talk about incorrectness, in my opinion I emphasised exactly the correctness of the answer.
Can you tell me if this is a realistic tester figure? And is it good or bad result for a year with a deposit of 3000$?
Does the lack of a soft sign offend that much?
I am driven by enlightenment, not offence. Why would I be offended, did you know how to spell and want to offend me? I didn't even consider that option, was it for nothing?
I am motivated by enlightenment, not resentment. Why should I be offended, did you know how to write correctly and want to offend me? I didn't even consider that option, was it for nothing?
Peace, friendship, chewing gum.
Peace, friendship, gum.
And the half-litres?