• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

StrategyPlot in NT8

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

  • lee612801
    started a topic StrategyPlot in NT8

    StrategyPlot in NT8

    Hi,

    I'm trying to convert my NT7 to NT8 and would like to add the plots. In NT7 i used the strategy plot as follows:

    protected override void Initialize ()
    {
    slopePriceLevel1 = new DataSeries(this);
    Add(StrategyPlot(0));
    StrategyPlot(0).Plots[0].Pen.Color = Color.Blue;
    StrategyPlot(0).PanelUI = 2;
    ...

    protected override void OnBarUpdate ()
    {
    slopePriceLevel1.Set(priceSlopeTrigger1);
    StrategyPlot(0).Value.Set(SMA(slopePriceLevel1, 1)[0]);
    ...

    Where slopePriceLevel1 is a parameter and priceSlopeTrigger1 is a data series.

    How do I do this in NT8?

    Thanks,

    Lee

  • 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

    https://ninjatrader.com/support/help...?isoverlay.htm

    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:

Latest Posts

Collapse

Topics Statistics Last Post
Started by fredfred, Today, 03:41 AM
2 responses
6 views
0 likes
Last Post fredfred  
Started by TraderYoda, Today, 03:33 AM
0 responses
0 views
0 likes
Last Post TraderYoda  
Started by pjsmith, Today, 02:56 AM
0 responses
2 views
0 likes
Last Post pjsmith
by pjsmith
 
Started by ntbone, Yesterday, 08:10 PM
0 responses
10 views
0 likes
Last Post ntbone
by ntbone
 
Started by chrislou, 08-28-2015, 03:27 AM
14 responses
2,882 views
0 likes
Last Post nkhoi
by nkhoi
 
Working...
X