Hi all,
I am working on a formula and I want to load the daily highs & lows for the last 300 days (minimum) into an array no matter what time frame my chart is. So I wrote a code similar to the one below:
for (i=1; i<=299;i++) DailyHigh[i]=high(-i,getSymbol()+",D");
My problem is if I did not load a Daily chart before (with at least 300 bars), or there are not 300 bars on the daily chart, the code stops at the above line and I can not go on further.
I tried to put some checks like
if (high(-i,getSymbol(),",D) ==null) {skip this step etc.}
but they did not work.
Any help on this?
Thank you all in advance,
I am working on a formula and I want to load the daily highs & lows for the last 300 days (minimum) into an array no matter what time frame my chart is. So I wrote a code similar to the one below:
for (i=1; i<=299;i++) DailyHigh[i]=high(-i,getSymbol()+",D");
My problem is if I did not load a Daily chart before (with at least 300 bars), or there are not 300 bars on the daily chart, the code stops at the above line and I can not go on further.
I tried to put some checks like
if (high(-i,getSymbol(),",D) ==null) {skip this step etc.}
but they did not work.
Any help on this?
Thank you all in advance,
Comment