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

Creating a Value within Strategy and then Plotting the value on Chart

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

    Creating a Value within Strategy and then Plotting the value on Chart

    I have never thought or attempted to do this (I may have to go back to indicator for this)

    But is if possible to create private double, then thru conditions create a mathematical value (like you might do with a moving average, or any cycling indicator plot)

    private double ABC;

    ABC = (condtion set)

    then have the strategy create a Plot of that value on the chart - preferable on the lower panels

    Thanks

    #2
    Hello DTSSTS,

    Thanks for your post.

    It would not be possible to assign a condition check to a double variable.

    You could consider checking your condition and then assigning a value to the double variable within that condition. That variable could then be assigned to a plot created by AddPlot() to plot the variable value onto a chart.

    See the help guide documentation below for more information.
    AddPlot: https://ninjatrader.com/support/help...t8/addplot.htm

    Or, are you wanting to set a variable’s value by using C#’s conditional operator?

    If so, this would be possible to do. Note that using the C# conditional operator would be considered C# education. It is against our policy to provide C# programming education services in our support department.

    For information about using C# conditional operators, you could do a quick google search for publicly available links. An example of a publicly available link demonstrating C# conditional operators could be found below.

    C# Conditional Operator: https://kodify.net/csharp/variables/...conditionally/

    Also, see the SMA indicator script that comes default with NinjaTrader in a NinjaScript Editor window which you may find helpful since it uses a C# conditional operator to assign a value to a plot.

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      I did create the AddPlot using documentation, but it is plotted in the main chart candle area, and of course that does not work very well with the values, ie stock price 148.00 and MyPlot = 1.08

      Can you direct me as to how to place the plot in the lower panel of chart
      Thanks

      Update I tried the below without success

      {
      DrawOnPricePanel = false;
      AddPlot(Brushes.Blue, "MyCycleATRPlot");
      }
      Last edited by DTSSTS; 02-23-2022, 03:02 PM.

      Comment


        #4
        Hello DTSSTS,

        Thanks for your note.

        You could set IsOverlay = false in State.SetDefault to have the strategy and plot set on a lower panel instead of on the price panel.

        See the attached example script demonstrating this.

        Let us know if we may further assist.
        Attached Files
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          That is a help but it places my backbrush drawings in the lower as well. Thanks for in help.

          Comment


            #6
            Hello DTSSTS,

            Thanks for your note.

            Setting IsOverlay = false in the strategy would add the entire strategy to a lower panel.

            If you would like to have a plot in a separate panel from the strategy, you would need to create an indicator with DrawOnPricePanel set to false and plots the value. Then, you could call AddChartIndicator() in the strategy to add the indicator to the strategy.

            See this help guide page for more information: https://ninjatrader.com/support/help..._strategie.htm

            Let us know if we may assist further.
            Brandon H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Jimmyk, 01-26-2018, 05:19 AM
            6 responses
            835 views
            0 likes
            Last Post emuns
            by emuns
             
            Started by jxs_xrj, 01-12-2020, 09:49 AM
            6 responses
            3,291 views
            1 like
            Last Post jgualdronc  
            Started by Touch-Ups, Today, 10:36 AM
            0 responses
            10 views
            0 likes
            Last Post Touch-Ups  
            Started by geddyisodin, 04-25-2024, 05:20 AM
            11 responses
            62 views
            0 likes
            Last Post halgo_boulder  
            Started by Option Whisperer, Today, 09:55 AM
            0 responses
            9 views
            0 likes
            Last Post Option Whisperer  
            Working...
            X