Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Waxavi, Today, 02:10 AM
    1 response
    17 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by Kaledus, Today, 01:29 PM
    5 responses
    13 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Waxavi, Today, 02:00 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by alifarahani, Today, 09:40 AM
    5 responses
    23 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by gentlebenthebear, Today, 01:30 AM
    3 responses
    17 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X