theme: creating Ashi bars.
I am writing in Java outside the ninja trader environment.
but I use the broker's data downloaded from the ninja trader.
the data is correct.
I am using the formula from this post
(Paul's answer is 03-25-2020 at 07:04 AM).
https://ninjatrader.com/support/foru...n-ashi-candles
and the code from the ninja trader editor.
but my calculated data is not the same as the Ashi bars on the chart. high and low prices are the same. and open and close are not.
1. when creating the first ashi bar, I take the data of the first regular bar.
2. when creating the next Ashi bars, I calculate from the previous Ashi bar. Only for creating the Close ashi bar, I used the data of the current regular bar.
3.after calculating open, close, high, low Ashi, I round them with my implementation of the RoundToTickSize() (NQ tick 0.25):
return: price % 1 == 0 ? price : Math.round (price / .25) * .25;
https://ninjatrader.com/support/help...toticksize.htm
"Returns a value that is rounded up to the nearest valid value evenly divisible by the instrument's tick size".
4. I expect the result with correct ashi bars after 540 5m ashi bars. but the open and close data are not correct, they are lower than what I see on the chart.
tell me please, where am I wrong? well, except that I'm programming in java.
Comment