I have written a couple of indicators (NT8) to try to get used to Ninjascipt but I am having problems with this one, and I cant find any indicators that I can copy from. I am starting with a bwFractal indicator to test Divergence against the MACD. I am trying to improve on the D3Spotter Divergence Indicator to later use in a strategy, so I need to write it myself..
When I put print lines and a counter in the bwFractal Indicator (Bottom of the Highs calculation) I see the enormous amount of data being created which I want to use. I have also created a resize array and printed that too to see that it worked. All this is happening fine with each loop. But as soon as I want to manipulate any of the data (or add a loop) whilst it is looping the indicator stops output and doesn't print the Fractals.
What I want to do is take say the first 30 Fractal Highs and probably use an array for storage, work out which Fractal Highs I want to use for Divergence against the MACD, test and plot the Divergence on the chart. I dont need to plot the divergence on the MACD because I can check that via the Databox. Then I want to add the next Fractal High and drop off the first Fractal High and do the same with those 30 Fractal Highs. As I wanted to test one additional Fractal high at a time (30 in total but add one / drop one) I was thinking the perfect time to do this was as the indicator was looping but it doesn't seem possible (to me).
Manipulating the data is not a big problem. My problem is being able to access the data so I can manipulate it. I don't know if I have to work out a way to read the data from the chart after the indicator has plotted all the fractals or if there is a special way of getting access to the data whilst it loops. I would need to do the same process with the Fractal Lows too.
Does anyone have any suggestions on the method I need to use.
Thanks. Ray
Comment