Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Visualisation of Account properties

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Visualisation of Account properties

    Hello Ninjas!

    I would like to plot some account information in a subplot under my chart while running a strategy on that chart. These information help to observe the over all development of a running strategy and are useful for back testing purpose, because they can help to identify "difficult" situations.

    When I create a new indicator, obviously the following code does not work:

    Code:
    Plot_Quantity.Set(Position.Quantity);
    There is no Position.Quantity in the scope of this indicator (it belongs to the strategy I guess) and I get a message which says that a Object Reference is needed. How can this be provided?

    When I create anther indicator using

    Code:
    Plot_CumProfit.Set(Performance.AllTrades.Performance.Currency.CumProfit);
    I get a message telling me the NinjaTrader.Strategy.Performance does not contain a definition for AllTrades (it may sound different because I translated this to English).

    Can somebody tell me what to do? Can I create an additionalsubplot (overlay = false) inside a strategy?

    thx

    Nathamus

    #2
    imported post

    A strategy object can't drive plots. You will need an indicator to do this. I am not sure if this will work but what I would try is adding an input Strategy to an indicator. Take a look at other indicators and how inputs are defined and declared as a property under the properties section of an indicator.

    In the OnBarUpdate() of the indidcator do something like:

    if (MyStrategy != null)
    Plot.Set(MyStrategy.Performance.AllTrades.Performa nce.Currency.CumProfit);


    In your strategy Initialize() do something like:

    Add(MyIndicator(this));



    This is beyond what we are really able to provide technical support for and does require some fundamental knowledgeof C# programming.

    Ray

    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    23 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    115 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    225 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    408 views
    0 likes
    Last Post CaptainJack  
    Working...
    X