Im trying to create an indicator that will show the daily up/down movement limits for grains products. I have got as far as the following. It marks the up/down limit for ZW/. I plan on adding this to my watchlist so only want it to return a number for ZW for now ( I hope to add all the grains to one indicator, but being a newbie the process is as important as the final result, so one step at a time).
MY first question is where and how can I add an if statement so that it will only return values for ZW?
Thanks in advance
MY first question is where and how can I add an if statement so that it will only return values for ZW?
Thanks in advance
PHP Code:
function preMain() {
setPriceStudy(true);
setStudyTitle("CBOT-ZW Daily Limit Move");
setCursorLabelName("PD-H", 0); // High Limit
setCursorLabelName("PD-L", 1); // Low Limit
setDefaultBarStyle(PS_SOLID, 0); // High Limit
setDefaultBarStyle(PS_SOLID, 1); // Low Limit
setDefaultBarFgColor(Color.red, 0); // High
setDefaultBarFgColor(Color.green, 1); // Low
setDefaultBarThickness(4, 0); // High
setDefaultBarThickness(4, 1); // Low
setPlotType(PLOTTYPE_FLATLINES, 0); // High
setPlotType(PLOTTYPE_FLATLINES, 1); // Low
}
var bInit = false;
var xHigh_Limit = null;
var xLow_Limit = null;
function main() {
if(bInit == false){
xHigh = high(inv("D"));
xLow = low(inv("D")) ;
bInit = true;
}
var vHigh = xHigh.getValue(-1) + 60;
var vLow = xLow.getValue(-1) - 60;
if( vHigh == null || vLow == null)
return;
return new Array (vHigh,vLow);
}
Comment