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

Synchronize indicator on all charts

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

    Synchronize indicator on all charts

    I have an indicator that I use on several charts with different timeframes. Is it possible that when I click on one of the buttons, in a chart, the information of that button is changed in all charts?


    so in the photo example, if I click on the long button then both charts set the button to long
    How can I do it?

    #2
    Hello lju45,

    That is not really something which general NinjaScript could accomplish, each indicator is a new instance so they are all separate. You can use a C# concept like static for that type of use which makes a variable part of the type instead of an instance. You can research C# static further to see if that would be useful for your specific use case.

    https://docs.microsoft.com/en-us/dot...eywords/static

    Static more or less makes a variable into a single source instead of having a different value for each specific instance that is running. This is a concept we do not suggest using in NinjaScript unless you have learned about static and are aware how it works, this will have adverse affects on the platform if you use it incorrectly on properties that should be isolated to a specific scripts instance.

    For your use case it could be suggested to make a public static property inside your indicator class which holds a value. In the button click you could update that value, any other script which references that static property by its Type.PropertyName format could see that value. This is not an event so other scripts would have to monitor for changes if they want to update something locally.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by f.saeidi, Today, 12:14 PM
    7 responses
    16 views
    0 likes
    Last Post f.saeidi  
    Started by Russ Moreland, Today, 12:54 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by philmg, Today, 12:55 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by TradeForge, 04-19-2024, 02:09 AM
    2 responses
    32 views
    0 likes
    Last Post TradeForge  
    Started by aprilfool, 12-03-2022, 03:01 PM
    3 responses
    329 views
    0 likes
    Last Post NinjaTrader_Adrian  
    Working...
    X