Announcement

Collapse
No announcement yet.

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.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    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
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        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.
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, 03-13-2026, 05:17 AM
            0 responses
            89 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            152 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            80 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            53 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            63 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X