Indicator is easier. In expert you can use array also, but elements will be ascending in oposite direction then in indicator, so you must count them by yourself.
And don't forget to check if there is a new bar! Important with fractal interp. testing.
so
Upper=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_UPPER,0);
Lower=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_LOWER,0);
Middle=iMA(NULL,0,BandsPeriod,0,MODE_SMA,PRICE_CLOSE,0);
BW=(Upper-Lower)/Middle;
if (Time[0]>PrevTime)
{
BWArray[count]=BW;
count++;
}
maxBW=0;
for (i=count-100;i<=count;i++)
{
if(BWArray[i]>maxBW) maxBW=BWArray[i];
}
maxBW/=4;
If(iClose(NULL,0,0)<Q)
also set count in initialization as 0 and BWArray big like last Bars in tester - if you will test it,
or you must set BWArray for 100 elements in initialization part, like
if (Bars>=100)
{
for (i=99;i<=0;i--)
{
Upper=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_UPPER,i);
Lower=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_LOWER,i);
BW=(Upper-Lower)/Middle;
BWArray[i]=BW;
count++;
}
} else "problem"
I didn't compile this, it's just a frame, but I think you can use it.
Regards
Rafael
And don't forget to check if there is a new bar! Important with fractal interp. testing.
so
Upper=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_UPPER,0);
Lower=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_LOWER,0);
Middle=iMA(NULL,0,BandsPeriod,0,MODE_SMA,PRICE_CLOSE,0);
BW=(Upper-Lower)/Middle;
if (Time[0]>PrevTime)
{
BWArray[count]=BW;
count++;
}
maxBW=0;
for (i=count-100;i<=count;i++)
{
if(BWArray[i]>maxBW) maxBW=BWArray[i];
}
maxBW/=4;
If(iClose(NULL,0,0)<Q)
also set count in initialization as 0 and BWArray big like last Bars in tester - if you will test it,
or you must set BWArray for 100 elements in initialization part, like
if (Bars>=100)
{
for (i=99;i<=0;i--)
{
Upper=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_UPPER,i);
Lower=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_LOWER,i);
BW=(Upper-Lower)/Middle;
BWArray[i]=BW;
count++;
}
} else "problem"
I didn't compile this, it's just a frame, but I think you can use it.
Regards
Rafael

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Upper=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_UPPER,0);
Lower=iBands(NULL,0,BB_Period,BB_Deviations,0,PRICE_CLOSE,MODE_LOWER,0);
Middle=iMA(NULL,0,BandsPeriod,0,MODE_SMA,PRICE_CLOSE,0);
BW=(Upper-Lower)/Middle;
Q= (***Max value of BW over last 100 bars***)/4 //Define the lowest Quartile range - need help here
If(iClose(NULL,0,0)<Q) // all the other code afterwards I can handle