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 to change instrument on chart by code

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

    how to change instrument on chart by code

    I am writing an indicator (of class Indicator).
    I'd like to know if it is possible to change the underlying instrument of an indicator by code. For example, lets say I have this indicator object currently works on instrument X. Now I need to work on instrument Y but as Y hasn't been loaded to the chart window by user, I want to make use of the indicator on X but change the instrument to Y. I'm not sure how it can be done though.
    Thanks.

    #2
    Hello emilien,

    Thanks for writing in.

    You will not be able to change the primary data series of an indicator indicator through a chart. This can be done manually within NinjaScript, however.

    Within NinjaScript, you may add an additional Data Series to a strategy or indicator to perform calculations on a data series other than the primary one set by the chart or window.

    There is a sample strategy that outlines this which may be of use to you:

    You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


    Please also take the time to read the documentation for the components listed within as well as the documentation on creating NinjaScript for Multi-Time Frame & Instruments:



    If you have any further questions, please don't hesitate to ask.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by PaulMohn, Today, 12:36 PM
    2 responses
    16 views
    0 likes
    Last Post PaulMohn  
    Started by Conceptzx, 10-11-2022, 06:38 AM
    2 responses
    53 views
    0 likes
    Last Post PhillT
    by PhillT
     
    Started by Kaledus, Today, 01:29 PM
    0 responses
    3 views
    0 likes
    Last Post Kaledus
    by Kaledus
     
    Started by yertle, Yesterday, 08:38 AM
    8 responses
    37 views
    0 likes
    Last Post ryjoga
    by ryjoga
     
    Started by rdtdale, Today, 01:02 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Working...
    X