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

volume up down read value

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

    volume up down read value

    hi
    i want to read volume up down value in below script.
    but i guess its shows only when bar is green and dont work for red bar.
    how can solve it?

    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 VoUpDown : Indicator
    {
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "VoUpDown";
    Calculate = Calculate.OnBarClose;
    IsOverlay = true;
    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.Second, 10);



    }
    }

    protected override void OnBarUpdate()
    {
    if (CurrentBars[0] < 5|| CurrentBars[1] < 5 )

    return;


    if (BarsInProgress ==1) //multi time 10 sec

    {

    double value = VolumeUpDown()[0];
    Print("The current Volume value is " + value.ToString());


    }








    //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 VoUpDown[] cacheVoUpDown;
    public VoUpDown VoUpDown()
    {
    return VoUpDown(Input);
    }

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

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

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

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

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

    #endregion


    #2
    Hello f.saeidi,

    For the down volume use the DownVolume plot

    Print(VolumeUpDown().DownVolume[0]);

    For the up volume use the UpVolume plot.

    Print(VolumeUpDown().UpVolume[0]);
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Is this volume show buy and sell volume
      Or its only show total volume base on level 2 data?

      Comment


        #4
        Hello f.saeidi,

        If the close is greater than the open the volume is added to the UpVolume plot. If the close is less than the open the volume is added to the DownVolume plot.

        This is level I market data only and is not level II market depth.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Which indicator show real buyer and seller volome?

          Comment


            #6
            Hello f.saeidi,

            Many users use the Order Flow Volumetric bars or Order Flow Cumulative Delta to show ask and bid volume.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Can you tell me which indicators work with level 2 data in total that show real market events and what happen in the market?

              Comment


                #8
                Hello f.saeidi,

                The Jtrealstats indicator on the User App Share uses Level II data.
                This is a conversion of the Realtime Level II/Tick Volume. Please contact the original author for any questions or comments. Update Aug 27th, 2018: Since OnRenderTargetChanged can be called before State.DataLoaded, setting the dxmBrushes["backColor"].MediaBrush here wasn&apos;t working out and was sometimes null. Changed this to now get the chart background color (and text color) from [&#8230;]


                I am also including a link to the help guide with an example of working with Level II data.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Am I right?
                  I fact many indicators in ninja is unusefull and don't show market facts?
                  If not which ones are useful and shows market facts?

                  Comment


                    #10
                    Hello f.saeidi,

                    If you are referring to Level II market depth, there are not many indicators I am aware of that use this.

                    This thread will remain open for any community members that know of other Level II indicators who would like to share.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Are you have any advise which indicator can show exact point for buy and sell point?
                      So I focus for that section script.
                      Thnx

                      Comment


                        #12
                        Hello f.saeidi,

                        Level II market depth data is working orders. Level I market data is where trades are occurring. If the last market update is at the bid, the orders included in that update were sell orders, if the last market update is at the ask the orders included in that update where buy orders. Market data provided from the exchange does not show individual trades, but the volume of executions at the ask or bid.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Thnx for your notes.
                          Any link can help me with more examples that explain how exactly market depth work and how can I understand it deeply?
                          Thnx

                          Comment


                            #14
                            Hello f.saeidi,

                            Below is a link to investopedia on Market Depth.
                            https://www.investopedia.com/terms/m/marketdepth.asp
                            https://www.investopedia.com/terms/d/depth-of-market.asp
                            Chelsea B.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by FishTrade, Yesterday, 11:11 PM
                            3 responses
                            11 views
                            0 likes
                            Last Post FishTrade  
                            Started by Graci117, Today, 09:02 PM
                            1 response
                            11 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by ETFVoyageur, Today, 07:55 PM
                            0 responses
                            8 views
                            0 likes
                            Last Post ETFVoyageur  
                            Started by janio973, Today, 07:24 PM
                            1 response
                            7 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by aligator, 01-06-2022, 12:14 PM
                            4 responses
                            250 views
                            0 likes
                            Last Post john_44573  
                            Working...
                            X