Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

volumetric buy sell arrow

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

    volumetric buy sell arrow

    hi
    i use script below for buy arrow but it seems its not show in correct condition.
    what is script problem?
    Best regard.

    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 Volumetric : Indicator
    {




    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "Volumetric";
    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)
    {

    AddVolumetric(null, BarsPeriodType.Range, 16, VolumetricDeltaType.BidAsk, 0);

    }
    }

    protected override void OnBarUpdate()
    {



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


    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
    if (barsType == null)
    return;



    double volume = barsType.Volumes[CurrentBar].TotalVolume;
    double mindelta= barsType.Volumes[CurrentBar].MinSeenDelta;
    double deltachange=(barsType.Volumes[CurrentBar].BarDelta) - (barsType.Volumes[CurrentBar-1].BarDelta);
    double deltash = barsType.Volumes[CurrentBar].DeltaSh;
    double deltasl= barsType.Volumes[CurrentBar].DeltaSl;

    Draw.TextFixed(this, "", "Volume: " +barsType.Volumes[CurrentBar].TotalVolume +
    "\nMin delta: " + barsType.Volumes[CurrentBar].MinSeenDelta +
    "\nDelta change: " + deltachange +
    "\nDelta SH: " + barsType.Volumes[CurrentBar].DeltaSh +
    "\nDelta SL: " + barsType.Volumes[CurrentBar].DeltaSl , TextPosition.TopLeft);



    if ( (deltasl > 10 && deltash==0) && (deltachange >0 || mindelta >=0) && volume > 1500 )
    {

    Draw.ArrowUp(this, "tag1" + CurrentBar.ToString(), true, 1, Low[0] - 20*TickSize, Brushes.SpringGreen);


    }







    }


    }
    }

    region NinjaScript generated code. Neither change nor remove.

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

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

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

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

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

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

    #endregion

    Last edited by f.saeidi; 04-10-2024, 03:52 AM.

    #2
    all volumetric values display correct on chart but
    for simple test i test if deltasl>10
    give me buy arrow again it was wrong.
    it seems if command dont work well for volumetric parameters.
    waiting....

    Comment


      #3
      Hello f.saeidi,

      Thanks for your post.

      If a script is not behaving as you are expecting it to, you must add debugging prints to the script to understand how your logic is behaving.

      To understand why the script is behaving as it is, such as drawing objects or not drawing objects when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

      In the script, add prints one line above the condition used to draw the arrow on the chart that prints out all the values being used in the condition along with the time of the bar (Time[0]), labels, and comparison operators so you know what values are being printed and how they are being compared.

      Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

      Below is a link to a forum post that demonstrates how to use prints to understand behavior.

      <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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      602 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      347 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      560 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      559 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X