Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Vector Candles

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

    Vector Candles

    Hi everyone. Apologies if this isn't the right spot to post this. I didn't think it classified as "indicator development"
    s
    I am looking for an indicator for Vector Candles. Basically color coded candles based on volume. Ill attach a screenshot to show you what I mean. I haven't had any luck finding anything. So I am hoping someone can point me in the right direction.

    Thanks!



    Attached Files

    #2
    Hello Adamcoin33,

    Thank you for the message.

    Unfortunately, I am not aware of any default bar type that changes colors depending on volume.

    Please feel free to submit this as a feature request for a future update at the link below:
    That being said, there is a similar item called the "Equivolume" Candlestick type.
    • This makes the bars wider or thinner depending on how much volume traded at that candle compared to others.
      • Right-click the chart > Click Data series > Scroll down to the Chart Style section > Chart Style setting > Set this to Equivolume > Click OK
        • Click image for larger version

Name:	image.png
Views:	206
Size:	75.4 KB
ID:	1340554
    Please let us know if we may provide any further assistance.

    Comment


      #3
      Thank you!

      Comment


        #4
        Look into PVSRA candles, I believe they are the same if not very similar. There are a couple posts on here about them.







        Comment


          #5
          AI translation of:https://www.tradingview.com/script/b...ector-Candles/ It does not have a native color picker, but maybe you can find it useful.

          PHP Code:
          #region Using declarations
          using System;
          using System.Collections.Generic;
          using System.ComponentModel;
          using System.ComponentModel.DataAnnotations;
          using System.Windows.Media;
          using System.Xml.Serialization;
          using NinjaTrader.Cbi;
          using NinjaTrader.Gui;
          using NinjaTrader.Gui.Chart;
          using NinjaTrader.Data;
          using NinjaTrader.NinjaScript;
          using NinjaTrader.Core.FloatingPoint;
          #endregion
          
          namespace NinjaTrader.NinjaScript.Indicators
          {
              /// <summary>
              /// Vector Candles indicator that visualizes climax and above-average volume candles on the chart.
              /// Uses PVSRA (Price, Volume, Support, and Resistance Analysis) to determine candle color based on volume and price action.
              /// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/​
              /// Original concept by plasmapug, rise retrace continuation by infernix, peshocore and xtech5192
              /// </summary>
              public class VectorCandles : Indicator
              {
                  #region Variables
                  private SolidColorBrush climaxUpBrush;
                  private SolidColorBrush climaxDownBrush;
                  private SolidColorBrush aboveAverageUpBrush;
                  private SolidColorBrush aboveAverageDownBrush;
                  private SolidColorBrush normalUpBrush;
                  private SolidColorBrush normalDownBrush;
                  
                  private Series<double> averageVolumeCache;
                  private Series<double> climaxVolumeCache;
                  private Series<double> highestClimaxVolumeCache;
                  private Series<int> vectorTypeCache;  // 0: normal, 1: climax, 2: above average
                  #endregion
          
                  protected override void OnStateChange()
                  {
                      if (State == State.SetDefaults)
                      {
                          Description = @"Vector Candles indicator that visualizes climax and above-average volume candles using PVSRA method";
                          Name = "VectorCandles";
                          Calculate = Calculate.OnBarClose;
                          IsOverlay = true;
                          DisplayInDataBox = true;
                          DrawOnPricePanel = true;
                          DrawHorizontalGridLines = true;
                          DrawVerticalGridLines = true;
                          PaintPriceMarkers = true;
                          ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                          
                          // Default colors
                          ClimaxUpColor = Colors.Lime;
                          ClimaxDownColor = Colors.Red;
                          AboveAverageUpColor = Color.FromRgb(33, 170, 255);
                          AboveAverageDownColor = Colors.Fuchsia;
                          NormalUpColor = Color.FromRgb(155, 155, 155);
                          NormalDownColor = Color.FromRgb(65, 65, 65);
                          
                          // Default parameters
                          AverageVolumeLength = 10;
                          AboveAverageMultiplier = 1.5;
                          ClimaxVolumeMultiplier = 2.0;
                      }
                      else if (State == State.Configure)
                      {
                          // Create series
                          averageVolumeCache = new Series<double>(this);
                          climaxVolumeCache = new Series<double>(this);
                          highestClimaxVolumeCache = new Series<double>(this);
                          vectorTypeCache = new Series<int>(this);
                          
          
                      }
                      else if (State == State.DataLoaded)
                      {
                          // Create the brushes in OnRenderTargetChanged
                      }
                  }
          
                  public override void OnRenderTargetChanged()
                  {
                      // Call base method first
                      base.OnRenderTargetChanged();
                      
                      // Don't need to dispose SolidColorBrush objects in NT8
                      
                      // Create new brushes tied to the current RenderTarget
                      climaxUpBrush = new SolidColorBrush(ClimaxUpColor);
                      climaxUpBrush.Freeze();
                      climaxDownBrush = new SolidColorBrush(ClimaxDownColor);
                      climaxDownBrush.Freeze();
                      aboveAverageUpBrush = new SolidColorBrush(AboveAverageUpColor);
                      aboveAverageUpBrush.Freeze();
                      aboveAverageDownBrush = new SolidColorBrush(AboveAverageDownColor);
                      aboveAverageDownBrush.Freeze();
                      normalUpBrush = new SolidColorBrush(NormalUpColor);
                      normalUpBrush.Freeze();
                      normalDownBrush = new SolidColorBrush(NormalDownColor);
                      normalDownBrush.Freeze();
                  }
          
                  protected override void OnBarUpdate()
                  {
                      // Skip calculations until we have enough bars
                      if (CurrentBar < AverageVolumeLength)
                          return;
                          
                      // Calculate average volume from the last N candles (default 10)
                      double sumVolume = 0;
                      for (int i = 0; i < AverageVolumeLength; i++)
                      {
                          sumVolume += Volume[i];
                      }
                      double averageVolume = sumVolume / AverageVolumeLength;
                      averageVolumeCache[0] = averageVolume;
                      
                      // Calculate climax volume on the current candle
                      double climaxVolume = Volume[0] * (High[0] - Low[0]);
                      climaxVolumeCache[0] = climaxVolume;
                      
                      // Find highest climax volume of the last N candles
                      double highestClimaxVolume = climaxVolume;
                      for (int i = 1; i < AverageVolumeLength; i++)
                      {
                          double pastClimaxVolume = Volume[i] * (High[i] - Low[i]);
                          if (pastClimaxVolume > highestClimaxVolume)
                              highestClimaxVolume = pastClimaxVolume;
                      }
                      highestClimaxVolumeCache[0] = highestClimaxVolume;
                      
                      // Determine the vector type (0: normal, 1: climax, 2: above average)
                      int vectorType = 0;
                      if (Volume[0] >= averageVolume * ClimaxVolumeMultiplier || climaxVolume >= highestClimaxVolume)
                          vectorType = 1; // Climax volume
                      else if (Volume[0] >= averageVolume * AboveAverageMultiplier)
                          vectorType = 2; // Above average volume
                      
                      vectorTypeCache[0] = vectorType;
                      
                      // Determine if bullish or bearish
                      bool isBullish = Close[0] > Open[0];
                      
                      // Set the candle colors based on vector type and bullish/bearish state
                      if (isBullish)
                      {
                          switch (vectorType)
                          {
                              case 1: // Climax up
                                  BarBrush = climaxUpBrush;
                                  CandleOutlineBrush = climaxUpBrush;
                                  break;
                              case 2: // Above average up
                                  BarBrush = aboveAverageUpBrush;
                                  CandleOutlineBrush = aboveAverageUpBrush;
                                  break;
                              default: // Normal up
                                  BarBrush = normalUpBrush;
                                  CandleOutlineBrush = normalUpBrush;
                                  break;
                          }
                      }
                      else
                      {
                          switch (vectorType)
                          {
                              case 1: // Climax down
                                  BarBrush = climaxDownBrush;
                                  CandleOutlineBrush = climaxDownBrush;
                                  break;
                              case 2: // Above average down
                                  BarBrush = aboveAverageDownBrush;
                                  CandleOutlineBrush = aboveAverageDownBrush;
                                  break;
                              default: // Normal down
                                  BarBrush = normalDownBrush;
                                  CandleOutlineBrush = normalDownBrush;
                                  break;
                          }
                      }
                      
                      // Pattern detection logic could be added here
                      // For example: bool redGreen = vectorType == 1 && isBullish && vectorTypeCache[1] == 1 && !IsBullish(1);
                  }
                  
                  #region Properties
                  
                  [NinjaScriptProperty]
                  [Display(Name = "Average Volume Length", Description = "Number of bars to calculate average volume", GroupName = "Parameters", Order = 1)]
                  [Range(1, int.MaxValue)]
                  public int AverageVolumeLength { get; set; }
                  
                  [NinjaScriptProperty]
                  [Display(Name = "Above Average Multiplier", Description = "Volume multiplier to consider above average (default 1.5)", GroupName = "Parameters", Order = 2)]
                  [Range(0.1, double.MaxValue)]
                  public double AboveAverageMultiplier { get; set; }
                  
                  [NinjaScriptProperty]
                  [Display(Name = "Climax Volume Multiplier", Description = "Volume multiplier to consider climax (default 2.0)", GroupName = "Parameters", Order = 3)]
                  [Range(0.1, double.MaxValue)]
                  public double ClimaxVolumeMultiplier { get; set; }
                  
                  // Color properties
                  [NinjaScriptProperty]
                  [XmlIgnore]
                  [Display(Name = "Climax Up Color", Description = "Color for climax up candles", GroupName = "Colors", Order = 1)]
                  public Color ClimaxUpColor { get; set; }
                  
                  [Browsable(false)]
                  public string ClimaxUpColorSerializable
                  {
                      get { return Serialize.BrushToString(new SolidColorBrush(ClimaxUpColor)); }
                      set { ClimaxUpColor = ((SolidColorBrush)Serialize.StringToBrush(value)).Color; }
                  }
                  
                  [NinjaScriptProperty]
                  [XmlIgnore]
                  [Display(Name = "Climax Down Color", Description = "Color for climax down candles", GroupName = "Colors", Order = 2)]
                  public Color ClimaxDownColor { get; set; }
                  
                  [Browsable(false)]
                  public string ClimaxDownColorSerializable
                  {
                      get { return Serialize.BrushToString(new SolidColorBrush(ClimaxDownColor)); }
                      set { ClimaxDownColor = ((SolidColorBrush)Serialize.StringToBrush(value)).Color; }
                  }
                  
                  [NinjaScriptProperty]
                  [XmlIgnore]
                  [Display(Name = "Above Average Up Color", Description = "Color for above average up candles", GroupName = "Colors", Order = 3)]
                  public Color AboveAverageUpColor { get; set; }
                  
                  [Browsable(false)]
                  public string AboveAverageUpColorSerializable
                  {
                      get { return Serialize.BrushToString(new SolidColorBrush(AboveAverageUpColor)); }
                      set { AboveAverageUpColor = ((SolidColorBrush)Serialize.StringToBrush(value)).Color; }
                  }
                  
                  [NinjaScriptProperty]
                  [XmlIgnore]
                  [Display(Name = "Above Average Down Color", Description = "Color for above average down candles", GroupName = "Colors", Order = 4)]
                  public Color AboveAverageDownColor { get; set; }
                  
                  [Browsable(false)]
                  public string AboveAverageDownColorSerializable
                  {
                      get { return Serialize.BrushToString(new SolidColorBrush(AboveAverageDownColor)); }
                      set { AboveAverageDownColor = ((SolidColorBrush)Serialize.StringToBrush(value)).Color; }
                  }
                  
                  [NinjaScriptProperty]
                  [XmlIgnore]
                  [Display(Name = "Normal Up Color", Description = "Color for normal up candles", GroupName = "Colors", Order = 5)]
                  public Color NormalUpColor { get; set; }
                  
                  [Browsable(false)]
                  public string NormalUpColorSerializable
                  {
                      get { return Serialize.BrushToString(new SolidColorBrush(NormalUpColor)); }
                      set { NormalUpColor = ((SolidColorBrush)Serialize.StringToBrush(value)).Color; }
                  }
                  
                  [NinjaScriptProperty]
                  [XmlIgnore]
                  [Display(Name = "Normal Down Color", Description = "Color for normal down candles", GroupName = "Colors", Order = 6)]
                  public Color NormalDownColor { get; set; }
                  
                  [Browsable(false)]
                  public string NormalDownColorSerializable
                  {
                      get { return Serialize.BrushToString(new SolidColorBrush(NormalDownColor)); }
                      set { NormalDownColor = ((SolidColorBrush)Serialize.StringToBrush(value)).Color; }
                  }
                  
                  #endregion
              }
          }&#8203; 
          

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          56 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          132 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          73 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X