I am currently facing an issue with the behavior of my script in Ninjatrader, specifically when I remove drawing objects using the "RemoveDrawObject(_tagName)" command. I am seeking your assistance in understanding and resolving this problem.
To provide some context, my script draws horizontal lines on the chart, which can be removed when the user clicks on them. My script can detect a mouse click on the horizontal line and remove the line using the 'RemoveDrawObject()' command. However, after successfully removing a horizontal line, an unexpected behavior occurs, albeit intermittently.
When the problem occurs, I am unable to select any other drawing objects on the chart. It seems as if Ninjatrader becomes locked in a "drag and move" mode with the cursor showing a four-headed arrow pointing in all four directions (up, down, left, and right). However, Ninjatrader remains responsive for selecting a menu item or clicking on any of the chart trader buttons or another chart etc..
I have discovered this temporary workaround for this issue. By right-clicking on the chart background and selecting the "Properties" menu item, then clicking "OK" without making any changes, or by pressing F6 to add another horizontal line, or even clicking on the 'Close button' on the chart trader panel, the cursor returns to its normal behavior and I can continue using the platform as usual.
I have verified that this problem is not a script error, as the horizontal line is successfully removed. However, the issue lies in the cursor behavior afterwards. I have thoroughly examined the documentation and searched for similar cases, but I have been unable to find a definitive solution.
Thank you once again for your willingness to help. Your expertise and support are truly appreciated.
P.S, I would like to mention that if sharing my indicator code or any relevant information would assist in diagnosing and resolving this intermittent misbehavior, I am more than willing to provide it. Please let me know if you believe that examining my indicator code or any specific details would be beneficial, and I will gladly share them with the community.
I have designed my indicator with the aim of providing users with a convenient and efficient method to attach any order type to visible plots on the chart. This functionality eliminates the need for users to navigate through the complexity of right-clicking on the chart background and selecting the indicator from a pop-up menu.

Comment