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

Code Snipet: Show to show one Dropdown InstrumentList selectable in chart

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

    #16
    looks like it CAN be done.

    First time I have seen this, great example done by Rancho Dinero here: Rancho Dinero | Creating a Trade Plan ( Looks like a side module is built and once prices are put in, it automatically updates on chart without hitting F5( refresh). I'm looking to build something similar to this, any resources would be wonderful.

    Comment


      #17
      Might also want to read this about dispose

      Comment


        #18
        Hi Sledge,

        Thanks again! In the dispose post, NinjaTrader_Joydeep mentioned the SendKeys method, which works when I added the following line of code directly after the code that sets MySMA's MySMAPeriodValue to 100.

        System.Windows.Forms.SendKeys.SendWait("{F5}");

        Now, when I press the button, the indicator refreshes to have a period of 100! I have uploaded the code in case it helps somebody else.

        The problem I have with this is that "SendKeys.SendWait("{F5}");" is not going to work all of the time, for instance if a user has a different hot key function set up for F5.

        Sledge, or anybody, is there a more robust (guaranteed to work on various user's machines, irregardless of what F5 is mapped to) way to programmatically refresh an indicator on a chart using "System.Windows.Forms.SendKeys.SendWait("{F5}" );"?

        Thanks to sledge and NinjaTrader_Joydeep for the information to get me this far!

        Equity Trader
        Attached Files

        Comment


          #19
          Try the attached - it will allow a user selected MA to be "toggled on/off" via Toolbar Button. Does this by changing Plot color to Transparent. Just add multiple instances with different period settings to get what you are after.

          This is based on code originally produced by Mindset on BMT.
          Attached Files

          Comment


            #20
            Hi rt-trader,

            Thanks a lot for the helpful code sample. I learned about "ChartControl.ChartPanel.Refresh();" from your code, and tried to use it to do two things:

            1. Change the color of an indicator, as you mentioned and as your code is intended to do. This worked nicely.

            2. Force an indicator to refresh on the chart with the new, programmatically applied public property (which is the period of a simple moving average). Unfortunately, the line "ChartControl.ChartPanel.Refresh();" didn't cause the indicator's data series values to be re-calculated and refreshed on the chart in the way that "System.Windows.Forms.SendKeys.Send("{F5}");" does.

            rt-trader, thanks again for the "ChartControl.ChartPanel.Refresh();" tip. This is a nice low-impact way to change indicator plot colors, widths, etc. without the more processor intensive and disruptive (to the UI) "SendKeys.Send("{F5}")".

            rt-trader, sledge, or anybody, is there a more robust (guaranteed to work on various user's machines, regardless of what F5 is mapped to) way to programmatically refresh an indicator's data series values (to account for a new, programmatically set SMA Period value for example), not just plot color and width, on a chart, instead of the less robust/reliable "System.Windows.Forms.SendKeys.SendWait("{F5}" );"?

            Thanks for all the help!

            EquityTrader

            Comment


              #21
              Hi Guys,

              Great thread. It looks as though there was no solution put forward to refresh the indicator programatically without having you use the sendkey function for F5.

              In my case, my button click events work great, the only issue is I have to use the Send Key F5 function (CPU intensive) or wait for the next market tick for the effects of the button click to take place.

              Has anyone found a solution?

              Thanks in advance for any assistance and I do understand that this falls into the "unsupported" realm but just putting it out there anyway
              Last edited by marty087; 06-19-2014, 04:29 AM.

              Comment


                #22
                jatubio Thank You very very march!!
                fx.practic
                NinjaTrader Ecosystem Vendor - fx.practic

                Comment


                  #23
                  Equity Trader, did You tried recaclculate and re-set SMA values on each bar?
                  Like:
                  Code:
                  OnButtonClick()
                  {
                     for( int i=CurrentBar; i>=0; i--)
                        Plot_Sma.Set( i, SMA(Period));
                  }
                  fx.practic
                  NinjaTrader Ecosystem Vendor - fx.practic

                  Comment


                    #24
                    Hi fx.practic,

                    Unfortunately, the post I made about this five years ago which you were asking me about was regarding a project that I haven't worked on since not long after that post, and I don't know where I even put the code or if I still have it. I'm sorry that I don't have an answer to your question at this time, but best of luck!

                    Best regards,

                    EquityTrader

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by CortexZenUSA, Today, 12:53 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post CortexZenUSA  
                    Started by CortexZenUSA, Today, 12:46 AM
                    0 responses
                    0 views
                    0 likes
                    Last Post CortexZenUSA  
                    Started by usazencortex, Today, 12:43 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post usazencortex  
                    Started by sidlercom80, 10-28-2023, 08:49 AM
                    168 responses
                    2,262 views
                    0 likes
                    Last Post sidlercom80  
                    Started by Barry Milan, Yesterday, 10:35 PM
                    3 responses
                    10 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Working...
                    X