Hello
Can someone explain to me the difference between these two codes?
First
******************************************************************************************
for(int i = limit-1; i >= 0; i--)
{
if (i >= MathMin(5000-1, rates_total-1-50)) continue;
//Indicator Buffer 1
if(iRSI(NULL, PERIOD_CURRENT, 4, PRICE_LOW, 0) > 90
&& iRSI(NULL, PERIOD_CURRENT, 4, PRICE_HIGH, 0) > 90
&& iRSI(NULL, PERIOD_CURRENT, 4, PRICE_CLOSE, 0) > 90
)
{
Buffer1[i] = High[i];
}
else
{
Buffer1[i] = 0;
}
}
******************************************************************************************
Second
******************************************************************************************
for(int i = limit-1; i >= 0; i--)
{
if (i >= MathMin(5000-1, rates_total-1-50)) continue;
//Indicator Buffer 1
if(iRSI(NULL, PERIOD_CURRENT, 4, PRICE_LOW, i) > 90
&& iRSI(NULL, PERIOD_CURRENT, 4, PRICE_HIGH, i) > 90
&& iRSI(NULL, PERIOD_CURRENT, 4, PRICE_CLOSE, i) > 90
)
{
Buffer1[i] = High[i];
}
else
{
Buffer1[i] = 0;
}
}
******************************************************************************************
The first version gives me a much better performance.
The difference is in the Shift parameters of the RSI indicator.
I do not understand why setting it to zero I get better results.
Thanks!
In the first you are always checking the current rsi (ie: future rsi in 99.9999999% of cases, repainting 101)
In the second you are checking the (i)th rsi value
In the first you are always checking the current rsi (ie: future rsi in 99.9999999% of cases, repainting 101)
In the second you are checking the (i)th rsi value
So if I understand correctly, in the first case, do I repaint my indicator?
Yes
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
Can someone explain to me the difference between these two codes?
First
******************************************************************************************
for(int i = limit-1; i >= 0; i--)
{
if (i >= MathMin(5000-1, rates_total-1-50)) continue;
//Indicator Buffer 1
if(iRSI(NULL, PERIOD_CURRENT, 4, PRICE_LOW, 0) > 90
&& iRSI(NULL, PERIOD_CURRENT, 4, PRICE_HIGH, 0) > 90
&& iRSI(NULL, PERIOD_CURRENT, 4, PRICE_CLOSE, 0) > 90
)
{
Buffer1[i] = High[i];
}
else
{
Buffer1[i] = 0;
}
}
******************************************************************************************
Second
******************************************************************************************
for(int i = limit-1; i >= 0; i--)
{
if (i >= MathMin(5000-1, rates_total-1-50)) continue;
//Indicator Buffer 1
if(iRSI(NULL, PERIOD_CURRENT, 4, PRICE_LOW, i) > 90
&& iRSI(NULL, PERIOD_CURRENT, 4, PRICE_HIGH, i) > 90
&& iRSI(NULL, PERIOD_CURRENT, 4, PRICE_CLOSE, i) > 90
)
{
Buffer1[i] = High[i];
}
else
{
Buffer1[i] = 0;
}
}
******************************************************************************************
The first version gives me a much better performance.
The difference is in the Shift parameters of the RSI indicator.
I do not understand why setting it to zero I get better results.
Thanks!