I added the below simple one line of code to the script to print the results (I skip the first candle as well when starting the script so as to not throw an error) and when there is a decimal in the result, it is not correct:
Print(Time[0]+" - "+Open[0]+" - "+Close[1]+" - "+Open[0]/Close[1]);
I am using 5min candles on the ES. When I run this script on the 5min ES using the Strategy Analyzer, here are some results I get in the NinajaScript Output window:
2/18/2021 3:20:00 PM - 3916.75 - 3916.5 - 1.00006383250351
2/18/2021 3:25:00 PM - 3915.25 - 3915 - 1.00006385696041
2/18/2021 3:30:00 PM - 3913.5 - 3913.5 - 1
2/18/2021 3:35:00 PM - 3914.75 - 3915 - 0.999936143039591
2/18/2021 3:40:00 PM - 3915.5 - 3915.25 - 1.00006385288296
2/18/2021 3:45:00 PM - 3915.75 - 3915.75 - 1
2/18/2021 3:50:00 PM - 3916 - 3916 - 1
2/18/2021 3:55:00 PM - 3912.75 - 3912.5 - 1.00006389776358
For example, the last line of results above, when you divide 3912.75/3912.5, the answer should be 1.02 and not 1.00006389776358. I tried multiplying the numbers together and that appeared to provide the correct result, but when I divide I get the incorrect result and I have no clue why. If I just hard code those numbers into the Print line (3912.75/3912.5) I get 1.02, so it is only when I use the Open[0]/Close[1]. There is no errors in the Log as this is the only line of code in the strategy. I also tried closing and restarting NinjaTrader and that did not fix the issue either.
Any assistance would be greatly appreciated.
Comment