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 pvincent, 06-23-2022, 12:53 PM
    14 responses
    238 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    383 views
    1 like
    Last Post Gavini
    by Gavini
     
    Started by oviejo, Today, 12:28 AM
    0 responses
    1 view
    0 likes
    Last Post oviejo
    by oviejo
     
    Started by pechtri, 06-22-2023, 02:31 AM
    10 responses
    125 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    59 views
    0 likes
    Last Post DynamicTest  
    Working...
    X