I do not see such an error when I test. I suggest first to redownload the script I have attached and perform the modifications just as I have in the video below.
Demo - https://drive.google.com/file/d/144c...w?usp=drivesdk
I may then suggest using a diff tool to compare your modifications to what I have posted, noting that you have added the CurrentBar check, removed the State.Historical check, and also commented out the Account.Flatten code that was given for testing. If the issue comes about from other code modifications, you will want to take debugging steps to understand how your modifications hit this error.
A publicly available diff utility is linked below.
This error would be seen if an object is null at the time it is being referenced. The solution would be to protect that code with a null check, or if the object should not be null, to track down when the object is set to null and when the object is assigned. Tracking down how the object is set to null and assigned can help to identify if an assignment was missed, or if the order object was set to null unintentionally.
Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm
Checking for null references - https://ninjatrader.com/support/help...references.htm
We look forward to assisting.
Comment