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 algospoke, Yesterday, 06:40 PM
    2 responses
    21 views
    0 likes
    Last Post algospoke  
    Started by ghoul, Today, 06:02 PM
    3 responses
    14 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    45 views
    0 likes
    Last Post jeronymite  
    Started by Barry Milan, Yesterday, 10:35 PM
    7 responses
    21 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by AttiM, 02-14-2024, 05:20 PM
    10 responses
    181 views
    0 likes
    Last Post jeronymite  
    Working...
    X