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

StrategyPlot in NT8

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

  • NinjaTrader_JoshG
    replied
    Lee,

    You would add the additional plot to something like the SampleOverlayPlot example. After that they would be in the same panel, and then you could set the panel from the strategy.

    Leave a comment:


  • lee612801
    replied
    Hi Josh,

    I figured out the issue with the CS0029 error. I needed to change the name of the strategy (SampleStrategyPlot) in the SamplePanelPlot indicator to the name of my strategy.

    But how do I add multiple plots to this same panel? Do I do it in the SamplePanelPlot indicator [by adding another AddPlot()] or can I do it in my strategy? What is the process for plotting multiple plots on the same panel?

    Thanks,
    Lee

    Leave a comment:


  • NinjaTrader_JoshG
    replied
    Lee,

    I am not sure why you would get that error with that snippet. I would expect it to compile fine if used in the same context as the sample strategy,

    What is the specific error description that is displayed next to the error code?
    Last edited by NinjaTrader_JoshG; 01-25-2019, 12:56 PM.

    Leave a comment:


  • lee612801
    replied
    Hi Josh,

    I'm trying to follow along with the SampleStrategyPlot for NT8. I'm bringing the code line by line over to my strategy. But I keep getting a CS0029 error on the sampleOverlayPlot.Strategy = this; in my strategy when compiling. Any ideas?

    Thanks,
    Lee

    Leave a comment:


  • NinjaTrader_JoshG
    replied
    lee612801,

    You are correct. You would not be able to use AddChartIndicator() without that plot actually being its own indicator.

    As far as why it's different specifically I am not sure. A lot of things that were created in Inititialize() in NT7 have been changed to work most efficiently with NT8's OnStateChange() method. You can most easily see the changes made for this concept by comparing the NT7 'Plot from a strategy' sample to the NT8 'Plot from a strategy sample'. I already provided the link for the NT8 sample above, but I will post both versions below as well.

    NT7: https://ninjatrader.com/support/help..._a_ninjasc.htm

    NT8; https://ninjatrader.com/support/help..._a_ninjasc.htm


    Additionally, you can see the rest of the code breaking changes here: https://ninjatrader.com/support/help...ng_changes.htm

    Leave a comment:


  • lee612801
    replied
    I'm probably wrong, but the reference example you provided above seems like it is creating a separate script that acts like an indicator just to use this feature. I guess I'm confused why NT7 had a relatively simple strategy plot function and NT8 does not?

    Can you use AddChartIndicator() for parameters (such as my fixed value) other than actual indicators?

    Thanks

    Leave a comment:


  • NinjaTrader_JoshG
    replied
    If you decide to use AddChartIndicator(), the order of the plots can be controlled from the strategy calling the ChartIndicators collection with the index of the indicator and set the panel for that indicator.

    ChartIndicators[0].Panel = 2;

    I've attached two examples created by a colleague of mine to demonstrate this. One uses multiple indicator types, the other uses multiple instances of the same indicator type. Other than this I suggest you go with the concepts from the help guide reference sample I provided above.

    Attached Files

    Leave a comment:


  • lee612801
    replied
    Josh,

    Thanks again for the help. I was able to get the separate panel to plot, but how do I get more than one panel on the chart? Using the IsOverlay=false put all my plots on the same panel. In NT7 I just used the StrategyPlot(0).PanelUI = ; to get the desired panel for each plot. How do you do this in NT8?

    Regards,
    Lee

    Leave a comment:


  • lee612801
    replied
    Josh,

    Thank you. I will chew on this for a bit.

    Regards,
    Lee

    Leave a comment:


  • NinjaTrader_JoshG
    replied
    lee612801,

    You would use IsOverlay=false

    Leave a comment:


  • lee612801
    replied
    Hi Josh,

    Thanks for the info. I was able to get the AddPlot to work by adding the Values parameter. But it plots the value as an overlay on the chart. How do I get the added plot to plot on its own separate panel below and not on the main panel as an overlay?

    Thanks,
    Lee

    Leave a comment:


  • NinjaTrader_JoshG
    replied
    lee612801,

    I would suggest using the concepts from the reference sample if you ever plan on plotting to multiple panels with that strategy. The ways you would go about adding a single plot is a little different.

    If you just need a single panel for now then you can use AddPlot() for a dynamic value, or AddLine() for a static value.

    https://ninjatrader.com/support/help...s/?addplot.htm

    https://ninjatrader.com/support/helpGuides/nt8/en-us/?addline.htm
    Last edited by NinjaTrader_JoshG; 01-14-2019, 02:50 PM.

    Leave a comment:


  • lee612801
    replied
    Hi Josh,

    The value is a parameter that does not change when the strategy is running. But it can be changed by the user in the strategy window.

    Yes, a single panel. Eventually I will want multiple panels (probably 3) below the main panel.

    Thanks,
    Lee

    Leave a comment:


  • NinjaTrader_JoshG
    replied
    lee612801,

    I fixed my links. Not sure what happened there..

    When you say a 'fixed parameter' do you mean that the value is never going to change?

    You only need to plot to single panel, correct?

    Leave a comment:


  • lee612801
    replied
    Hi Josh,

    thanks for the response. Some of the links did not work. Also, the example pulls from an indicator which didn’t really help me. Lets start simple. How do I plot a fixed parameter value from within my strategy in my strategy on a separate panel right below the main panel? Let’s say my fixed parameter is called PanelPlot.

    Thanks,
    Lee

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Irukandji, Today, 09:34 AM
0 responses
1 view
0 likes
Last Post Irukandji  
Started by TraderBCL, Today, 04:38 AM
3 responses
24 views
0 likes
Last Post NinjaTrader_Jesse  
Started by WeyldFalcon, 08-07-2020, 06:13 AM
11 responses
1,423 views
0 likes
Last Post jculp
by jculp
 
Started by RubenCazorla, Today, 09:07 AM
0 responses
4 views
0 likes
Last Post RubenCazorla  
Started by BarzTrading, Today, 07:25 AM
2 responses
29 views
1 like
Last Post BarzTrading  
Working...
X