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 reynoldsn, Today, 02:34 PM
    0 responses
    6 views
    0 likes
    Last Post reynoldsn  
    Started by nightstalker, Today, 02:05 PM
    0 responses
    9 views
    0 likes
    Last Post nightstalker  
    Started by llanqui, Yesterday, 09:59 AM
    8 responses
    28 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by quicksandatl, Today, 01:39 PM
    1 response
    6 views
    0 likes
    Last Post quicksandatl  
    Started by md4866, 05-01-2024, 08:15 PM
    2 responses
    18 views
    0 likes
    Last Post md4866
    by md4866
     
    Working...
    X