There is something funny going on with my drawing tools on charts, and I am not sure if it is intended or not, or perhaps I’ve messed up something in my code...
If I have a drawing object on a chart, then change the symbol to a new symbol which doesn’t have any of that drawing object type, my indicator is still finding a ghost drawing tool there, even though if I right-click on the new symbol and bring up the drawing objects, it displays none.
Is there some sort of filter I need to add to my loop to ensure it only brings up objects from the current displayed symbol and not a prior symbol in the same chart window? I first noticed this when I was writing an indicator for horizontal lines and have come across it again for the Risk Reward tool.
I have attached a sample indicator to reproduce using the following steps:
- Open up a new chart (I used 5min EURUSD) when connected to live or replay data
- Add the attached indicator ‘TestingDrawingTools’
- Open a Ninjascript Output window
- Ensure there are no previous drawing tools on the chart
- Draw an RR tool
- Observe the output window is saying it has found ‘1’ RR tool on the chart
- Draw another RR tool on the same chart. Observe the output window is saying it has found ‘2’ RR tools on the chart
- Change the symbol to something else (I used AUDUSD)
- Observe the output is still finding 2 RR tools on the chart (even though there are none on this new symbol)
- Right click on the chart and go to Drawing Tools > Drawing Objects
- Observe there are no RR drawing objects on the chart
- Exit the drawing objects dialoug box
- Draw an RR tool on that chart
- The output window has now increased to finding 3 objects (2 from the old symbol and 1 that we have just drawn)
- Bring up the drawing objects for the chart, and it is showing only the 1 object even though the output window still says 3.
Thanks guys, any help appreciated.
Cheers,
Shane
Comment