I have written the following formula:
function preMain()
{
setPriceStudy(true);
setStudyTitle("Parabolic SAR Entry");
}
// Sets Parabolic SAR variables
var PrevSAR = 0;
var CurrSAR = 0;
function main()
{
// Gets Parabolic SAR value for current bar and previous bar
CurrSAR = sar(.15, .07, .3)
PrevSAR = sar(.15, .07, .3, -1)
debugClear();
debugPrintln("CurrSAR: " + CurrSAR);
debugPrintln("PrevSAR: " + PrevSAR);
}
When I load this in a 400 tick chart for AB #F or AB U5 in the Bar Replay Mode, the values are returned properly in the Formual Output Window. If I click the Replay button, or click Go Forward, the subsequent values returned in the window are:
PrevSAR: NaN
CurrSAR: null
If I let it sit on a bar for a while (about 60 seconds or so), sometimes the NaN and the null will change to a correct SAR value, but only occassionally. I only have 3 days of data in the chart. Any idea what the problem is in my formula?
I am running 7.91 on a 3.2 Mhz CPU with 2 gig of RAM on XP Pro ,with my broker's application as the only other application software installed on the machine, so I'm assuming the problem is in the formula.
function preMain()
{
setPriceStudy(true);
setStudyTitle("Parabolic SAR Entry");
}
// Sets Parabolic SAR variables
var PrevSAR = 0;
var CurrSAR = 0;
function main()
{
// Gets Parabolic SAR value for current bar and previous bar
CurrSAR = sar(.15, .07, .3)
PrevSAR = sar(.15, .07, .3, -1)
debugClear();
debugPrintln("CurrSAR: " + CurrSAR);
debugPrintln("PrevSAR: " + PrevSAR);
}
When I load this in a 400 tick chart for AB #F or AB U5 in the Bar Replay Mode, the values are returned properly in the Formual Output Window. If I click the Replay button, or click Go Forward, the subsequent values returned in the window are:
PrevSAR: NaN
CurrSAR: null
If I let it sit on a bar for a while (about 60 seconds or so), sometimes the NaN and the null will change to a correct SAR value, but only occassionally. I only have 3 days of data in the chart. Any idea what the problem is in my formula?
I am running 7.91 on a 3.2 Mhz CPU with 2 gig of RAM on XP Pro ,with my broker's application as the only other application software installed on the machine, so I'm assuming the problem is in the formula.
Comment