Hi,
When plotting a sma by hard-coding the time interval, I have no issues with what is returned. Works great.
When I try to plot the same sma using getInterval(), I get contracted, wierd compressed data points.
My objective is to grab the interval and use it to plot the sma, so that when the user changes the display interval of a chart, the sma will update and redraw automatically based on the new time parameters.
Any help would be appreciated.
[BTW - is there a simple way to attach a .png file so I could show you what I mean? ]
Ryan.
When plotting a sma by hard-coding the time interval, I have no issues with what is returned. Works great.
When I try to plot the same sma using getInterval(), I get contracted, wierd compressed data points.
My objective is to grab the interval and use it to plot the sma, so that when the user changes the display interval of a chart, the sma will update and redraw automatically based on the new time parameters.
Any help would be appreciated.
[BTW - is there a simple way to attach a .png file so I could show you what I mean? ]
Ryan.
PHP Code:
var cStudyTitle = "TickMA";
var gInt = getInterval();
// var vTickSMA = sma(13, sym("$Tick,15")); // *** this works fine ***
// var vTickInst = sma(1, sym("$Tick,15"));
var vTickSMA = sma(13, sym("$Tick,gInt")); // *** this does not ***
var vTickInst = sma(1, sym("$Tick,gInt"));
var bInt = false;
var fpArray = new Array();
function preMain() {
debugClear();
setComputeOnClose(true)
setPriceStudy(false);
setStudyTitle(cStudyTitle);
setShowCursorLabel(true);
setShowTitleParameters(false);
setCursorLabelName("Tick", 0);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarThickness(3, 0);
setPlotType(PLOTTYPE_LINE, 0);
setCursorLabelName("TickInst", 1);
setDefaultBarStyle(PS_DOT, 1);
setDefaultBarFgColor(Color.green, 1);
setDefaultBarThickness(2, 1);
setPlotType(PLOTTYPE_LINE, 1);
}
function main() {
if(!bInt) {
// debugClear();
bInt = true;
}
var Tick = vTickSMA.getValue(0);
if (Tick == null) return;
var TickInst = vTickInst.getValue(0);
if (TickInst == null) return;
return new Array (Tick, TickInst);
}
Comment