Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PVT indicator will not plot

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

    PVT indicator will not plot

    I have to search the world far and wide trying to find a "Price Volume Trend" indicator for NT8, but I have had no luck.
    So here I am trying to write the code for a PVT indicator.

    The code I have will compile, but when I insert the indicator into a chart, it does not plot anything - just a blank panel.

    I think others have also tried to find a PVT indicator, so success in this endeavor will probably benefit, others.

    I know enough about programming to be somewhat dangerous.
    Any help would be appreciated.
    Code:
    			#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 PVT : Indicator
    			{
    			private Text mytexttool;
    			private Brush axisColor;
    			private Gui.Tools.SimpleFont chartFont;
    
    
    			protected override void OnStateChange()
    			{
    			if (State == State.SetDefaults)
    			{
    			Name = "PVT ";
    
    			// Adds a blue line style plot
    			AddPlot(Brushes.Blue, "PVTtotal");
    
    			}
    			}
    
    
    
    
    			protected override void OnBarUpdate()
    			{
    
    
    			// start PVTcode
    			double myClose0 = Close[0];
    			double myClose1 = Close[1];
    			double percentChg = 0;
    			double PVTtoday = 0;
    			double PVTtotal = 0;
    
    			// Calculate the Percentage Change in closing price.
    			// ( Closing Price [today] - Closing Price [yesterday] ) / Closing Price [yesterday]
    			percentChg = ((myClose0 - myClose1) / myClose1 );
    
    			// Multiply the Percentage Change by Volume. This is today PVT.
    			// Percentage Change * Volume [today]
    			PVTtoday = (percentChg * Volume[0]);
    
    
    			// Add to yesterday's cumulative total.
    			// Percentage Change * Volume [today] + PVT [yesterday]
    			PVTtotal = ( PVTtoday + PVTtotal);
    
    
    
    			}
    			}
    			}

    #2
    Hello goodknight777,

    It doesn't look like this indicator sets a plot value anywhere.

    Value[0] = 100;
    or
    Values[0][0] = 100;

    Below is a link to the help guide on Value, Values, and AddPlot().


    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    581 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    336 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
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X