Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

plz help to plot Raw Bid Ask volume code

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

    plz help to plot Raw Bid Ask volume code

    i am trying to plot current bid and ask volume on 1 second chart. i am totally noob in coding. below is code i converted from ninjatrader 7 but i getting some error so plz help me to correct it.
    thanks.

    Code:
    namespace NinjaTrader.NinjaScript.Indicators
    {
    public class BidAskVol : Indicator
    {
    private int myInput0 = 1;
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "BidAskVol";
    Calculate = Calculate.OnEachTick;
    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)
    {
    AddPlot(new Stroke(Brushes.Blue), PlotStyle.Bar, "Plot0");
    AddPlot(new Stroke(Brushes.Red), PlotStyle.Bar, "Plot1");
    }
    }
    
    protected override void OnBarUpdate()
    {
    if (CurrentBars[0] < 1)
    return;
    
    Plot0.Set(GetCurrentAskVolume[0]);
    Plot1.Set(GetCurrentBidVolume[0]);
    }

    #2
    Hello jay1987,

    Thanks for your post.

    The Plot.Set() method is only available to use in NinjaTrader 7. This will lead to compile errors in NinjaTrader 8.

    To assign a value to a plot in NinjaTrader 8 you could do something like Plot0[0] = X; where X is the value are you assigning to the plot.

    See this help guide page for more information about the AddPlot() method and assigning value to plots: https://ninjatrader.com/support/help...t8/addplot.htm

    Below I am including a link to a list of the code-breaking changes from NinjaTrader 7 to NinjaTrader 8 for you to review.
    http://ninjatrader.com/support/helpG...ng_changes.htm
    <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
      Thanks Brandon H.
      i try but still i got error in this line. whats mistake i do.


      AddPlot(new Stroke(Brushes.Blue), PlotStyle.Line, "myPlot0");
      AddPlot(new Stroke(Brushes.Red), PlotStyle.Line, "myPlot1");
      }
      }

      protected override void OnBarUpdate()
      {
      if (CurrentBars[0] < 1)
      return;


      myPlot0[0] = GetCurrentAskVolume;
      myPlot1[1] = GetCurrentBidVolume;​



      thanks.

      Comment


        #4
        Hello jay1987,

        Thanks for your notes.

        You are not using the correct syntax for GetCurrentAskVolume() and GetCurrentBidVolume() in your script.

        Parentheses need to be added at the end of GetCurrentAskVolume() and GetCurrentBidVolume() since they are methods.

        GetCurrentAskVolume()
        GetCurrentBidVolume()


        See the syntax for these methods in the help guide documentation linked below.

        GetCurrentAskVolume(): https://ninjatrader.com/support/help...taskvolume.htm
        GetCurrentBidVolume(): https://ninjatrader.com/support/help...tbidvolume.htm
        <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
          Thanks a lot for help Brandon H.

          now its working.

          thanks again.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          81 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          41 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          64 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          66 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          54 views
          0 likes
          Last Post CarlTrading  
          Working...
          X