Thanks for your notes.
This message indicates that an object in your script that you are accessing is returning null.
A common object-oriented programming error is not checking for null references on your object variables This will cause an "Object reference not set to an instance of an object" error.
I do not see anything specific in your code that stands out as incorrect. That said, you will need to reduce the code and add debugging prints throughout the script to determine the exact line of code that is causing the error to occur. Below is a link to a forum post that demonstrates how to use prints to understand behavior.
https://ninjatrader.com/support/foru...121#post791121
Let us know if we may assist further.
Comment