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 Add Plots in SampleMultiTimeFrame Strategy

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

    How to Add Plots in SampleMultiTimeFrame Strategy

    Hello - I have taken the SampleMultiTimeFrame Strategy from the Educational Section and used AddPlot to get plots to show on a chart. This works in the Strategy Analyzer but not in Market Replay or IRT. Is there a way to get them to show in Market Replay and IRT?

    2nd question: Is it possible to get the plots to show in Panels 2 and 3? This would be particularly helpful with a StochasticsMTF Strategy.

    3rd question: Is it possible to get the added Data Series to also show in Panels 2 and 3?

    My Print statements to the Output window vs the Data Box show the values are correct.


    Thank you for any help. Click image for larger version

Name:	SampleMultiTimeFrame_StrategyAnalyzer.PNG
Views:	315
Size:	185.2 KB
ID:	1108686

    #2
    Hello JohnS52,

    Thank you for your post.

    In my testing with your provided script I am able to see the plots on the chart on real time data and market replay.

    Just as in an indicator, plots from a strategy may only be plotted on a single panel. However, if you do need to plot some plots in the main panel and some in a separate panel, we have a help guide example that shows you how that may be achieved:



    It would not be possible to plot the secondary data series from the Strategy; you would just need to add the additional series to the chart window through the Data Series menu.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thank you, Kate. Yes, I see them now. I was trying to add them to a chart with 3 data series and they didn't appear but they will add to a 1 data series chart.

      This SampleStrategy Overlay code is a little over my skill level. I am getting 4 errors in the Editor: two CS0029 and two CS0103. Any suggestions on how to correct them? I don't know how to declare the variables: neither double or int worked.

      Attached Files

      Comment


        #4
        Hello JohnS52,

        Thank you for your reply.

        Could you provide your current code for this? I can't really tell what's going on from just the errors provided.

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

        Comment


          #5
          The code won't compile with the added code so I am attaching a Text file. I removed the AddPlot/Values code (that was plotting yesterday) for clarity.
          Attached Files

          Comment


            #6
            Hello JohnS52,

            Thank you for your reply.

            I've created a strategy which combines the Multi Time Frame and Sample Strategy Plot Strategies that does compile. I've attached that below.

            The errors you were getting are from two things:

            First, the indicators included are still referencing the old SampleStrategyPlot strategy:

            Code:
                    [Browsable(false)]
                    [XmlIgnore()]
                    public NinjaTrader.NinjaScript.Strategies.SampleStrategyPlot Strategy
                    {
                        get;set;    
                    }
            That reference would need to be changed to the strategy you're creating.

            Secondly, you're not instantiating the variables for the series that we're storing values in in the parameters section:


            Code:
                    #region Parameters
                    [Browsable(false)]
                    [XmlIgnore()]
                    public Series<double> OverlayPlot;
            
                    [Browsable(false)]
                    [XmlIgnore()]
                    public Series<double> PanelPlot;     
                    #endregion
            Please let us know if we may be of further assistance to you.
            Attached Files
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Sparkyboy, Today, 10:57 AM
            0 responses
            1 view
            0 likes
            Last Post Sparkyboy  
            Started by TheMarlin801, 10-13-2020, 01:40 AM
            21 responses
            3,916 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by timmbbo, 07-05-2023, 10:21 PM
            3 responses
            152 views
            0 likes
            Last Post grayfrog  
            Started by Lumbeezl, 01-11-2022, 06:50 PM
            30 responses
            809 views
            1 like
            Last Post grayfrog  
            Started by xiinteractive, 04-09-2024, 08:08 AM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_Erick  
            Working...
            X