would this be an appropriate method?
if (DrawObject("PASignalBarBreakoutFailureTick_Test") == null)
this file MySharedMethods.cs resides in the indicators/My folder
is that correct
I'm going to export all my indicators into a DLL
namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator { public string DrawObject(string DrawObjectTag) { foreach (DrawingTool draw in DrawObjects.ToList()) { if (draw.Tag == DrawObjectTag) { return DrawObjectTag; } } return null; } } }
Note: Methods within partial classes should be use the "public" and "static" modifiers, to allow for any other classes to invoke the methods without requiring an instance of the partial class.
As soon as I add static to
public[B] static [/B]string DrawObject(string DrawObjectTag)
An object reference is required for the non-static field, method, or property 'NinjaTrader.Gui.NinjaScript.IndicatorRenderBase.D rawObjects.get'
behavior in the test indicator:
reloading historical data doesn't find the manually drawn object, reload NinjaScript works, probably because of that
"When reloading NinjaScript, all objects (including manual drawing tools) are reloaded at the same time. There is no guarantee a manually drawn object will be added to the DrawObjects collection before an indicator starts processing data."
I'll use a workaround in that case
Comment