I really need this document. I am trying to get a $TRIN ma for an indicator. The built in function will not let me add a symbol to the MA. Can someone help me with this?
Thank you
Thank you
var vSymbol = ""; function preMain() { setPriceStudy(false); setStudyTitle("Symbol, MA: "); setCursorLabelName(vSymbol + " MA "); } function ma(nSymbol, nLength) { if (nSymbol == null) { return null; } if (nLength == null) { nLength = 10; } var i; var vSum = 0.0; var vValue; vValue = getValue("Close", 0, -nLength, nSymbol); if(vValue == null) { return null; } for(i = 0; i < nLength; i++) { vSum += vValue[i]; } return (vSum / nLength); } function main(nSymbol, nLength) { if (nSymbol == null) { nSymbol = "$TRIN"; } if (nLength == null) { nLength = 10; } if (getBarState() == BARSTATE_ALLBARS) { vSymbol = nSymbol; preMain(); } var MA = ma(nSymbol, nLength); return MA; }
Comment