Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Volumetric Bars as Secondary Data Series

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

    #46
    thnx for notes.
    what about buy sell arrow ?
    how can i make buy sell arrow triangle up and down script?
    i dont want to use strategy builder and want to write direct script.

    Comment


      #47
      Hello f.saeidi,

      Thanks for your notes.

      This question is unrelated to this forum thread about accessing Volumetric Bars data for secondary data series.

      That said, you could use the Draw.ArrowUp() and Draw.ArrowDown() methods to draw an up arrow or down arrow on the chart.

      See the help guide documentation below for more information.

      Draw.ArrowUp(): https://ninjatrader.com/support/help...aw_arrowup.htm
      Draw.ArrowDown(): https://ninjatrader.com/support/help..._arrowdown.htm

      I suggested using the Strategy Builder because it is a great tool for setting up conditions or actions and clicking the 'View code' button to see the generated code used to create those conditions and actions in a NinjaScript. You could then copy the generated code for those conditions or actions into your custom NinjaScript.

      For any other questions that may arise not related to accessing Volumetric Bars data for a secondary series, please create a new forum thread for the new question.
      <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


        #48
        please look below script:

        region Using declarations
        using System;
        using System.Collections.Generic;
        using System.ComponentModel;
        using System.ComponentModel.DataAnnotations;
        using System.Linq;
        using System.Text;
        using System.Threading.Tasks;
        using System.Windows;
        using System.Windows.Input;
        using System.Windows.Media;
        using System.Xml.Serialization;
        using NinjaTrader.Cbi;
        using NinjaTrader.Gui;
        using NinjaTrader.Gui.Chart;
        using NinjaTrader.Gui.SuperDom;
        using NinjaTrader.Gui.Tools;
        using NinjaTrader.Data;
        using NinjaTrader.NinjaScript;
        using NinjaTrader.Core.FloatingPoint;
        using NinjaTrader.NinjaScript.DrawingTools;
        #endregion

        //This namespace holds Indicators in this folder and is required. Do not change it.
        namespace NinjaTrader.NinjaScript.Indicators
        {
        public class RsiAlert : Indicator
        {
        double rsi_m1;




        protected override void OnStateChange()
        {
        if (State == State.SetDefaults)
        {
        Description = @"Enter the description for your new custom Indicator here.";
        Name = "RsiAlert";
        Calculate = Calculate.OnPriceChange;
        IsOverlay = false;
        DisplayInDataBox = true;
        DrawOnPricePanel = true;
        DrawHorizontalGridLines = true;
        DrawVerticalGridLines = true;
        PaintPriceMarkers = true;
        ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
        //Disable this property if your indicator requires custom values that cumulate with each new market data event.
        //See Help Guide for additional information.
        IsSuspendedWhileInactive = true;
        }
        else if (State == State.Configure)
        {

        AddDataSeries(null,BarsPeriodType.Minute,1);





        }
        }

        protected override void OnBarUpdate()
        {



        if (CurrentBars[0] < 5|| CurrentBars[1] < 5 )

        return;


        if (BarsInProgress ==1) //multi time 1 min

        {

        rsi_m1 = RSI(14, 3)[0];

        if(rsi_m1 > 70)
        Alert("myAlert", Priority.High, "BUY SIGNAL",
        NinjaTrader.Core.Globals.InstallDir+@"\sounds\buys ell alert.wav", 1
        , Brushes.Black, Brushes.Yellow);



        Draw.ArrowUp(this, "tag1", true, 0, Low[0] - TickSize, Brushes.Green);




        }





        //Add your custom indicator logic here.
        }
        }
        }

        region NinjaScript generated code. Neither change nor remove.

        namespace NinjaTrader.NinjaScript.Indicators
        {
        public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
        {
        private RsiAlert[] cacheRsiAlert;
        public RsiAlert RsiAlert()
        {
        return RsiAlert(Input);
        }

        public RsiAlert RsiAlert(ISeries<double> input)
        {
        if (cacheRsiAlert != null)
        for (int idx = 0; idx < cacheRsiAlert.Length; idx++)
        if (cacheRsiAlert[idx] != null && cacheRsiAlert[idx].EqualsInput(input))
        return cacheRsiAlert[idx];
        return CacheIndicator<RsiAlert>(new RsiAlert(), input, ref cacheRsiAlert);
        }
        }
        }

        namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
        {
        public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
        {
        public Indicators.RsiAlert RsiAlert()
        {
        return indicator.RsiAlert(Input);
        }

        public Indicators.RsiAlert RsiAlert(ISeries<double> input )
        {
        return indicator.RsiAlert(input);
        }
        }
        }

        namespace NinjaTrader.NinjaScript.Strategies
        {
        public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
        {
        public Indicators.RsiAlert RsiAlert()
        {
        return indicator.RsiAlert(Input);
        }

        public Indicators.RsiAlert RsiAlert(ISeries<double> input )
        {
        return indicator.RsiAlert(input);
        }
        }
        }

        #endregion




        in script when rsi >70 i want to get alert and arrow up.
        problem is arrow dont work correctly and when price change then arrow location change immediately.

        Comment


          #49
          Hello f.saeidi,

          Thanks for your notes.

          The condition does not have opening and closing curly braces so only the Alert() method is called when that condition triggers. The Draw.ArrowUp() method is being called on each bar update.

          Add curly braces to the condition and place your Alert() and Draw.ArrowUp() methods within the curly braces to have both of those methods trigger when the condition is true.

          For example:

          Code:
          if (rsi_m1 > 70)
          {
              //call Alert() and Draw.ArrowUp() methods here.
          }
          When you pass in the same Tag name for the Tag argument of the Draw.ArrowUp() method, the draw object will be updated instead of a new draw object being created.

          To have a new draw object be created each time the condition occurs, use a unique tag name for your Draw method. For example, a tag name of "Tag" + CurrentBar would be a unique tag name.

          From the help guides linked in post # 48:

          "tag: A user defined unique id used to reference the draw object.
          For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time."


          If a NinjaScript is not behaving as expected, such as drawing objects or not drawing objects as expected, you must add debugging prints to the script to understand how your logic is behaving.

          Review the forum post linked below that demonstrates how to use prints to understand behavior.


          For any other questions that may arise NOT related to accessing Volumetric Bars data for a secondary series, please create a new forum thread for the new question.
          <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


            #50
            thnx. as your advice i opened new topic.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            629 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            564 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X