I'm trying to use an elliott study in a backtest strategy. The elliott.getValue(GetElliottStudy.MOSTRECENTWAVEBAR INDEX) always seems to return the very last wave on the chart instead of changing as bars are loaded. In addition, if you put a bar offset in the getValue call it seems to be ignored. The following code doesn't give you the bar index of the next most recent wave. This is unexpected. Is there a way to get the bar indexes of prior waves using the getValue calls? I know I could do it checking each bar with the WAVE and manually keep track of the bar index, but that would be a pain.
Thanks,
Steve
Thanks,
Steve
PHP Code:
var elliott = new GetElliottStudy(300, 0, 50, 5, 35, 0);
function preMain()
{
setStudyTitle("GET test1");
setPriceStudy(true);
setCursorLabelName("MOSTRECENTWAVE", 0);
setCursorLabelName("MOSTRECENTWAVEBARINDEX", 1);
setCursorLabelName("NEXTMOSTRECENTWAVEBARINDEX", 2);
}
function main()
{
if(elliott.getValue(GetElliottStudy.MOSTRECENTWAVEBARINDEX) === null)
return;
// get the bar index of the most recent wave and look 1 past that for the next most recent wave bar index
var i = elliott.getValue(GetElliottStudy.MOSTRECENTWAVEBARINDEX);
return new Array(elliott.getValue(GetElliottStudy.MOSTRECENTWAVE)+" ",
elliott.getValue(GetElliottStudy.MOSTRECENTWAVEBARINDEX)+" ",
elliott.getValue(GetElliottStudy.MOSTRECENTWAVEBARINDEX, i-1)+" ");
}
Comment