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

Does "<An Indicator Variable>.Panel=2;" ever do anything on a live or backtest chart?

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

    Does "<An Indicator Variable>.Panel=2;" ever do anything on a live or backtest chart?

    Hi NinjaTrader Technical Support,

    I have a strategy with 5 SMA indicators that I add to the chart upon which the strategy is applied using the "AddChartIndicator(<My Indicator Variable>)" syntax.

    By default, all of the SMA indicators plot to Panel #1, the main price chart panel.

    My goal is to plot 3 of the SMA indicators on Panel #2 and leave 2 of the SMA indicators on the main price chart panel.

    I don't want each of the 3 "non-main chart panel" SMA indicators to be plotted on their own chart panels one below the other (which can be accomplished with syntax like mySMAVariable1.IsOverlay = false), but rather I want all 3 of them to plot on the same panel that is directly below the main price chart panel.

    I tried to accomplish this by setting the 3 SMA indicators' "Panel" property to 2 (like mySMAVariable1.Panel = 2), but this has no effect on either a back-test results chart in the Strategy Analyzer or a real-time chart with the strategy applied to it.

    Does "<An Indicator Variable>.Panel = 2;" ever do anything on a live or back-test chart?

    How can my Strategy plot multiple SMA indicators on Panel 2?


    Thanks in advance,

    EquityTrader

    #2
    Hello EquityTrader,

    Thank you for your post.

    If you are using a NinjaScript Strategy to load the indicators on the chart, this does allow the panel to be selected for the added indicator with the ChartIndicators collection. This should be done in
    https://ninjatrader.com/support/help...indicators.htm

    I've linked an example created by one of my colleagues that demonstrates below.


    Please let us know if we may be of further assistance to you.

    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hello NinjaTrader_Kate,

      Thank you for your quick response.

      Unfortunately, the example created by your colleague doesn't work on my machine, using the current version of NinjaTrader 8 (8.0.23.2 64-bit). It neither works in a live chart nor does it work in a Strategy Analyzer chart, as shown in the images below. Notice how in both of the screenshots below the plots are plotted on the main price panel, not on Panel 2 or 3.

      Here is a screenshot of it not working in a live chart:

      Click image for larger version

Name:	StrategyPlotPanelSelectExample_LiveChart.png
Views:	166
Size:	44.9 KB
ID:	1137422

      Here is a screenshot of it not working in a Strategy Analyzer chart:

      Click image for larger version

Name:	StrategyPlotPanelSelectExample_StrategyAnalyzerChart.png
Views:	214
Size:	89.3 KB
ID:	1137421

      The results were the same whether or not I checked the "Reverse Panel Order" checkbox.

      Does it work on your machine, using NinjaTrader 8 (8.0.23.2 64-bit)?

      What should I do differently to get this example working?

      Thanks again. I really appreciate your help.

      EquityTrader

      Comment


        #4
        Hello EquityTrader,

        Thank you for your reply.

        Yes, it works on my end using a Daily BTCUSD chart:

        Click image for larger version

Name:	2021-01-19_13-32-21.png
Views:	217
Size:	127.5 KB
ID:	1137432

        I'm also using 8.0.23.2 64 bit as well.

        Do you see any errors in the log tab of the Control Center regarding the Strategy? I'm not seeing anything strange in your settings that would cause the indicators not to plot in separate panels.

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hello NinjaTrader_Kate,

          Thank you for trying it out on your computer.

          I tried it again on my computer, on a live chart just like the one in the screenshot I previously posted, and I still have the same problem.

          Also, the only log grid row that appeared when I opened a BTCUSD chart and applied and enabled the strategy on it was this one:

          Time Column:
          1/19/2021 14:58

          Category Column:
          Default

          Message:
          Enabling NinjaScript strategy 'StrategyPlotPanelSelectExample/153931041' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position ErrorHandling=Stop strategy, cancel orders, close positions ExitOnSessionClose=True / triggering 30 seconds before close SetOrderQuantityBy=Strategy ConnectionLossHandling=Recalculate DisconnectDelaySeconds=10 CancelEntriesOnStrategyDisable=False CancelExitsOnStrategyDisable=False Calculate=On bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes


          Any thoughts on why it is acting differently on my machine vs. your machine?

          I should note that while I am running the strategy on a live BTCUSD chart, I am only using the free version of NinjaTrader 8. I can definitely see the live data coming in nicely, because the current price label keeps changing as I would expect if I were getting live data.

          Is this a feature that only works if you pay for a license?

          Thanks again,

          EquityTrader

          Comment


            #6
            Hello EquityTrader,

            Thank you for your reply.

            No, there wouldn't be anything restricted based on license type. Which data provider are you getting live data for BTCUSD from so I can try testing making sure everything is matching? I am currently using a Coinbase connection for data.

            Thanks in advance; I look forward to assisting you further.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Hello NinjaTrader_Kate,

              I am also using the Coinbase connection for data. Here is a screenshot:

              Click image for larger version

Name:	MyCoinbaseConnection.png
Views:	185
Size:	23.0 KB
ID:	1137451

              Thanks again,

              EquityTrader

              Comment


                #8
                Hello EquityTrader,

                Thank you for your reply.

                Yours is set up the same as mine. I'd like to take a look at your log and trace files to see if there are any hints there as to why it's not displaying correctly for you. Since those may contain personal information, let's have you send those in directly from the platform. You can do this by going to Help > Email Support. Please put 2926992 ATTN Kate W. in the subject line and a link to this post in the body of the email. Ensure that Log and Trace files is checked (this should be checked automatically).

                Thanks in advance; I look forward to assisting you further.
                Kate W.NinjaTrader Customer Service

                Comment


                  #9
                  Hello NinjaTrader_Kate,

                  I sent you my log and trace files as you instructed.

                  Thanks again for all your help,

                  EquityTrader

                  Comment


                    #10
                    Hi NinjaTrader_Kate,

                    I haven't heard back from you for a bit so I thought I would check in.

                    I still have this problem.

                    I have tried setting "<An Indicator Variable>.Panel = 2;" before "AddChartIndicator(<An Indicator Variable>);" and after it, I've tried reproducing the sample you linked to above but inside my own strategy, i.e. I tried calling "ChartIndicators[1].Panel = 2;" after calling "AddChartIndicator(<An Indicator Variable>);", and tried to plot an indicator on another panel using all of these techniques in both the Strategy Analyzer and real-time charts, and as far as I can tell, neither ""<An Indicator Variable>.Panel = 2;" nor "ChartIndicators[1].Panel = 2;" does anything at all.

                    The only thing that works for me is to plot each of the 3 "non-main chart panel" SMA indicators on their own chart panels one below the other (which can be accomplished with syntax like mySMAVariable1.IsOverlay = false), but I need all 3 of them to plot on the same panel that is directly below the main price chart panel.

                    Are you sure the Strategy and Indicator you linked to above works reliably on an installation of NinjaTrader 8 that isn't set up a certain way?

                    I think something is wrong with NinjaScript's processing of "<An Indicator Variable>.Panel = 2;" or "ChartIndicators[1].Panel = 2;", but of course I could be wrong.

                    Any thoughts?

                    Thanks,

                    EquityTrader

                    Comment


                      #11
                      Hello EquityTrader,

                      Thank you for your reply.

                      I've actually sent you a reply via email earlier this morning - I do apologize as I was out of the office yesterday and it appears my colleagues didn't get a chance to review your ticket. I'm including that reply below in case you didn't receive it:

                      I only see one error that occurred several times in your log:

                      2021-01-19 08:00:01:543 ERROR: Strategy 'XXXXXX': Error on calling 'OnBarUpdate' method on bar -1: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

                      However, this error does not stem from the example indicator/strategy but one of your strategies.

                      I don't see anything obvious that would prevent the example from plotting in separate panels as intended. Let's have you test in a blank workspace with no other workspaces open.

                      To do so, please open a new workspace from the workspaces menu, then hover over any workspaces with a gray box next to their name and click the Close button next to each to close them.

                      Then, open a BTCUSD daily chart and apply the example strategy. Do you see the plots in separate panels?
                      I've currently tested with a brand new clean installation of NinjaTrader. The only changes I made were to assign one of the indicator instances to the chart Panel and one to a panel below. Nothing else has been imported into the installation and the only other thing I set up was a Coinbase connection:

                      Click image for larger version  Name:	2021-01-21_11-18-20.png Views:	0 Size:	315.9 KB ID:	1137751

                      So no, no special set up necessary to get this to work.

                      Thanks in advance; I look forward to assisting you further.
                      Last edited by NinjaTrader_Kate; 01-22-2021, 10:16 AM. Reason: removed strategy name upon request
                      Kate W.NinjaTrader Customer Service

                      Comment


                        #12
                        Hi Kate,

                        Thanks for the email and this forum response. I am sorry I missed your email this morning.

                        Unfortunately, this didn't work either. I keep getting both plots on the main chart panel, and no chart panels being created beneath it.

                        Here is what I tried:

                        #1. I did just what you said (created new, blank workspace, then closed my other workspace, then opened daily BTCUSD chart, then applied strategy), except that I needed to connect to the Coinbase connection in order to click the "Enabled" checkbox in the Stategies tab after I added the strategy to the chart, but my chart looked identical to the one I posted earlier.

                        #2. I removed the strategy from the chart, re-downloaded the strategy and indicator you posted, re-compiled, and tried again. It still didn't work.

                        #3. I cleared the NinjaTrader8 cache. It still didn't work.

                        #4. I then changed the code:

                        Code:
                        ChartIndicators[0].Panel = (ReversePanelOrder) ? 3 : 2;
                        ChartIndicators[1].Panel = (ReversePanelOrder) ? 2 : 3;
                        to

                        Code:
                        ChartIndicators[0].Panel = 0;
                        ChartIndicators[1].Panel = 1;
                        in order to match your screenshot, and I changed the colors of the plots to Blue and Purple like this:

                        Code:
                         IndicatorPlot1Brush = Brushes.Blue;
                        IndicatorPlot2Brush = Brushes.Purple;
                        as a sanity check to ensure that I was even loading the strategy that I was looking at in the NinjaScript Editor, and it didn't work (but the colors of the plots changed as expected).

                        Here are the screenshots of the Strategy's code, the way the strategy looked on the Daily BTCUSD chart, and the Strategies tab.

                        Click image for larger version

Name:	Panel2Issue.png
Views:	214
Size:	81.0 KB
ID:	1137770

                        Click image for larger version

Name:	Panel2IssueChart.png
Views:	146
Size:	52.8 KB
ID:	1137771

                        Click image for larger version

Name:	Panel2IssueStrategiesTab.png
Views:	160
Size:	27.0 KB
ID:	1137772

                        Is there anything else we can try to figure this out? I am out of ideas.

                        Thanks again for all the help.

                        EquityTrader

                        Comment


                          #13
                          Hello EquityTrader,

                          Thank you for your reply.

                          Let's have you test with a clean environment to ensure no other NinjaScript Addons may be affecting the display.

                          To do this, first shut down NinjaTrader, then go to your Documents folder and rename the NinjaTrader 8 folder to "NinjaTrader 8 Current" (this will ensure we can easily switch back to your current data).

                          Next, go to the Uninstall a Program area of the Windows Control Panel. Find NinjaTrader 8 in the list, then right click on it and select "Repair". Once that completes, it should have generated a fresh user folder in your Documents.

                          Restart NinjaTrader, then skip through the initial screen where it asks you to put in a username and password. Set up a new Coinbase connection, then import the below script. Open a BTCUSD chart and apply the strategy. Do not edit the strategy so we can ensure we are testing with the same thing.

                          Do you see it plot with the green line in the main panel and the orange line in it's own panel?

                          Once you've completed the test, you can shut down NinjaTrader, go back to your Documents folder, delete the "NinjaTrader 8" folder, and rename the original NT8 folder from "NinjaTrader 8 Current" back to just NinjaTrader 8, then restart NinjaTrader for your original data to be used again.

                          Thanks in advance; I look forward to assisting you further.
                          Attached Files
                          Kate W.NinjaTrader Customer Service

                          Comment


                            #14
                            Hi NinjaTrader_Kate,

                            I did what you asked and it still doesn't work.

                            I closed NinjaTrader, renamed the folder you mentioned, I didn't have a "Repair" option in Control Panel so I completely uninstalled NinjaTrader 8, rebooted by computer, went to NinjaTrader.com and re-downloaded the newest version, installed it and chose the "Light" theme, checked in the NinjaScript Editor to ensure that none of my old strategies and indicators were displayed in the lists on the righthand side of the NinjaScript Editor window, downloaded your zip file, copied and pasted the strategy and the indicator into the respective folders, saw that they were in the NinjaScript Editor and re-compiled for good measure, re-created my Coinbase connection, connected to Coinbase, opened a real-time Daily BTCUSD chart, added the strategy to it, checked the "Enabled" checkbox in the Strategies tab, and unfortunately the plots are still drawn on the main price panel, not a separate panel, just like in my first screenshot when I first posted about this problem.

                            Here is the chart showing the same problem, and a screenshot of the NinjaScript Editor to give you confidence that I did what you asked correctly:

                            Click image for larger version

Name:	Panel2IssueChartAfterReinstall.png
Views:	202
Size:	56.8 KB
ID:	1137815

                            Click image for larger version

Name:	Panel2IssueEditorAfterReinstall.png
Views:	154
Size:	98.0 KB
ID:	1137816


                            What's next? I am willing to do a screenshare or something if you or one of your teammates wants to see that I am doing the things that you are asking of me correctly.

                            I greatly appreciate all of your help.

                            Thanks again,

                            EquityTrader





                            Comment


                              #15
                              Hello EquityTrader,

                              Thank you for your reply.

                              Yes, at this point we'd need to do a remote session to assess what may be occurring and get a copy of your installation so we can try to reproduce the issue on our end. If you could respond to my email from yesterday so we can set that up, that would be best.

                              Thanks in advance; I look forward to assisting you further.
                              Kate W.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by wzgy0920, 04-20-2024, 06:09 PM
                              2 responses
                              26 views
                              0 likes
                              Last Post wzgy0920  
                              Started by wzgy0920, 02-22-2024, 01:11 AM
                              5 responses
                              32 views
                              0 likes
                              Last Post wzgy0920  
                              Started by wzgy0920, Yesterday, 09:53 PM
                              2 responses
                              49 views
                              0 likes
                              Last Post wzgy0920  
                              Started by Kensonprib, 04-28-2021, 10:11 AM
                              5 responses
                              191 views
                              0 likes
                              Last Post Hasadafa  
                              Started by GussJ, 03-04-2020, 03:11 PM
                              11 responses
                              3,230 views
                              0 likes
                              Last Post xiinteractive  
                              Working...
                              X