I am trying to get either the price or indicator payne to signal an indicator cross of ma. when I load, nothing happens. vVSI is defined as a function() outside of the main. Any ideas? Without the signal code, the plotting is fine, with it, the plot doesn't occur.
Thanks!
Carson
var vVSI = null;
var vEma = null;
bInit = false;
function main() {
if(!bInit){
vVSI = getSeries(efsInternal("myVSI")); //~ returns the series for VSI
vEma = getSeries(ema(5, vVSI));
bInit = true;
}
if(vVSI > vEma){
setBarBgColor(Color.green);
} else {
if(vVSI < vEma) {
setBarBgColor(Color.red);
}
return Array (vVSI, vEma);
Thanks!
Carson
var vVSI = null;
var vEma = null;
bInit = false;
function main() {
if(!bInit){
vVSI = getSeries(efsInternal("myVSI")); //~ returns the series for VSI
vEma = getSeries(ema(5, vVSI));
bInit = true;
}
if(vVSI > vEma){
setBarBgColor(Color.green);
} else {
if(vVSI < vEma) {
setBarBgColor(Color.red);
}
return Array (vVSI, vEma);
Comment