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

NinjaScript Addon working on Chart symbols and/or Market Watch

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

    NinjaScript Addon working on Chart symbols and/or Market Watch

    We're a group if traders working with an addon that we developed, which consists of an external program which scans thousands of symbols in realtime, using an external datafeed API, and write on a file the list of the best symbols, according to certain criteria.

    Than an addon in the trading platform reads the file with the symbol list, and puts these symbols in a predefined numbers of already opened charts.

    This addon was quite easy to develop in MT and SC, but we're stuck with Ninja Trader... perhaps we don't know where to look for.

    Imagine there is a NT workspace with, let's say, 20 opened charts. We're trying to write NinjaScript code which reads the file with the symbol list (already done) and put each of these symbols in one of the openend charts. We can't find a way to obtain the list of opened charts in the active Workspace, and change the symbol in each chart.

    We kindly ask for a solution to:
    1. obtain a list of currently opened charts in the active workspace
    2. cycle this list and change the symbol in each chart
    These looks like things already implemented internally... it's more or less the way in which symbol linking works, so there could/should be also a way to do it with NinjaScript.

    Alternatively, but less preferably, we could also solve our need with a Market Watch window, if we can find a way with NinjaScript to:
    1. create a new symbol list in Ninja Trader
    2. replace all the symbols in an already opened Market Watch with the new list, or opening a new Market Watch with all the symbols in the new symbol list.

    Thanks.

    #2
    Hello, thanks for writing in. There is no supported, documented NinjaScript code that can get all open charts in the workspace and change the chart symbol but it can be done. There is an example here showing how to get all open charts in the workspace:

    https://ninjatrader.com/support/foru...ons#post837439

    To change the symbol, you can use the fact that typing into the chart causes the instrument search to activate, e.g. you can type "MSFT" into a chart and press Enter, and the symbol will change to Microsoft. C#/.NET has a method called SendKeys() that lets you emulate keyboard typing through code.

    https://learn.microsoft.com/en-us/do...owsdesktop-7.0

    Now, this would require the script to run on the chart to use SendKeys(), unfortunately, I do not have any examples or guidance on how you would do this through an addon since its not documented/supported.

    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Many thanks.

      Can the SendKeys part run from inside a custom indicator attached to a chart? Will the keys be sent to the chart the indicator is attached to?

      Comment


        #4
        Hi, that is correct. The keys will be sent to the containing chart if SendKeys is called from an indicator.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by curtly, Today, 01:37 AM
        4 responses
        25 views
        0 likes
        Last Post curtly
        by curtly
         
        Started by pstrusi, Today, 05:14 AM
        3 responses
        32 views
        0 likes
        Last Post pstrusi
        by pstrusi
         
        Started by Triple_M, Today, 07:48 AM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by gbourque, Today, 08:45 AM
        1 response
        9 views
        0 likes
        Last Post gbourque  
        Started by TwilightD, Today, 08:44 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X