Hello,
Below is a simple program where I am trying to use ATR9 and ATR26. When I used the print statement, it prints NULL.
What am I doing wrong? I want to use the current value throughout the code. Sometimes, I will reference the atr9 at previous bars too so I need an array.
function main() {
var nNumberBars;
var nIndex = getCurrentBarIndex();
nNumberBars = getNumBars();
if ( (bInit==false) && (nNumberBars != 0) )
{
if (atr9 == null) atr9 = atr(9);
if (atr26 == null) atr26 = atr(26);
debugPrintln("atr9=",atr9.getValue(0));
if ((nIndex==0) && (nNumberBars != 0) )
{
// my function
}
return(currentstrategy+overextension);
}
Below is a simple program where I am trying to use ATR9 and ATR26. When I used the print statement, it prints NULL.
What am I doing wrong? I want to use the current value throughout the code. Sometimes, I will reference the atr9 at previous bars too so I need an array.
function main() {
var nNumberBars;
var nIndex = getCurrentBarIndex();
nNumberBars = getNumBars();
if ( (bInit==false) && (nNumberBars != 0) )
{
if (atr9 == null) atr9 = atr(9);
if (atr26 == null) atr26 = atr(26);
debugPrintln("atr9=",atr9.getValue(0));
if ((nIndex==0) && (nNumberBars != 0) )
{
// my function
}
return(currentstrategy+overextension);
}
Comment