Can and how an Add-On access a public variable from an indicator?

Hi,

Is there a way for an Add-On to read a public variable (like a bool or a double) from an indicator?

For example, if I have a custom indicator running on a chart, can I expose a value from it that an Add-On can access in real time?

Would it be as straightforward as how data is shared between an indicator and a strategy (like exposing a public property and referencing the instance)?
Or is a different approach needed when dealing with Add-Ons?

Any suggestions or best practices for sharing simple data like this between an indicator and an Add-On would be appreciated.

Thanks,
Fz

Yes. I think a good way to approach it is to use an event driven design. Something like the below. Note that it’s not really an “Add-On” since I’m not using it as such. It’s just organized in the Add-Ons directory. The basic idea for the repository is to minimize anything that requires NinjaTrader by creating them in separate partial classes. Everything else are decoupled from it so it can be tested. Events and services are used between different components for notification of data being updated. order-flow-bot/NinjaTrader/Custom/AddOns/OrderFlowBot at main · WaleeTheRobot/order-flow-bot · GitHub

1 Like