Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How does an Addon directly retrieves bid price?

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

    How does an Addon directly retrieves bid price?

    Hello,

    I'm developing an addon for calculation the correct position size (in relation to a given stopLoss).

    This means, that the addon has to find out the base price of that instrument in my account currency.

    For example: My strategy works on the USD/CAD. This strategy calls the risk-management-addon for calculation the positionsize.

    The risk-management-addon should then return the base price for USD/CAD in my account currency EUR. This means, the addon should be able to retrieve the actual price for EUR/USD.

    How could this be done? AddDataSeries doesn't seem to work in the addon context...


    Many thanks,

    Catherine

    #2
    Hello erkees,

    When you are working outside of a script that runs on a chart like a strategy or indicator, the standard ways of adding series do not apply because there is no context of what data is needed. You could implement the BarsRequest example that we have in the example addon here: http://ninjatrader.com/support/helpG...t_overview.htm (the link: Download AddOn Framework NinjaScript Basic file to your desktop)

    In this addon it demonstrates a number of topics so it can be overwhelming at first, but this provides a working example of the BarsRequest concept. We also have this documented at the following link: http://ninjatrader.com/support/helpG...arsrequest.htm

    A general idea could be something similar to the following:

    Your strategy calls upon the addon in whatever means you currently are using.
    In the addon you check if you already have a subscription for this instrument and if not subscribe to it.
    From that point you could use the Update event handler of the BarsRequest to populate variables in the addon which could be returned to the strategy when requested.

    With this being said this is only an idea, you would need to explore this idea further as I am unaware of how you are currently connecting the strategy and addon. However you want to accomplish the connection between the two should be fine so long as you implement some logic to provide the instrument so it can be subscribed to.

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    548 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    549 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X