I am trying to create a very basic indicator that will be continually developed into something more and more complex over time.(NT8)
To start out, though, I am just trying to get a horizontal ray to be formed at the high of a certain candle when the criteria is met.
When the high of a candle is higher than the previous 4 candles and higher than the following 2 candles, it should place a horizontal ray at the high of that candle.
The logic seems very easy - but I am getting a very strange result.
Here is my current code as found in OnBarUpdate()
protected override void OnBarUpdate() { if (CurrentBars[0] < 6) return; if (High[0] < High[2] && High[1] < High[2] && High[3] < High[2] && High[4] < High[2] && High[5] < High[2] && High[6] < High[2]); { Draw.Ray(this,"test",2,High[2],0,High[2],Brushes.Blue); Print(string.Format("{0};{1};{2};{3};{4};{5};{6};{7}", Time[0],High[0],High[1],High[2],High[3],High[4],High[5],High[6])); } }
The primary problem is that there is only one candle to the left that has a lower high than the one with the ray. According to what I believe I have written, it should not be placed there because there need to be 4 candles to the left that have a lower high.
Here is a copy of the Output Window:
04-Aug-16 11:00:00 PM;1.75658;1.76176;1.76005;1.75028;1.76;1.76577;1.76778 05-Aug-16 11:00:00 PM;1.72168;1.75658;1.76176;1.76005;1.75028;1.76;1.76577 08-Aug-16 11:00:00 PM;1.72238;1.72168;1.75658;1.76176;1.76005;1.75028;1.76 09-Aug-16 11:00:00 PM;1.70495;1.72238;1.72168;1.75658;1.76176;1.76005;1.75028 10-Aug-16 11:00:00 PM;1.7011;1.70495;1.72238;1.72168;1.75658;1.76176;1.76005
So how could this have created the Ray?
Can you point me in the right direction to be able to fix this bug?
Thank you!
Comment