
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
indicator displacement
Collapse
X
-
indicator displacement
Hello I have the displacements for the VOL and CurrencDayOHL all set to 0 however they are only appearing once 20 bars on a Today5m chart have passed. How can i get these moved over to the start of the day? Here is the chart and the chart setup:
Tags: None
-
Originally posted by tortexal View PostHello I have the displacements for the VOL and CurrencDayOHL all set to 0 however they are only appearing once 20 bars on a Today5m chart have passed. How can i get these moved over to the start of the day? Here is the chart and the chart setup:
Comment
-
Thanks for the responses, The strategy is set to a 1 bar requirement simply to offset potential inaccuracies of the first bar printed due to a difference in local system time and my IB feed versus actual opening price. However, it won't really have any effect on my strategy based on how the strategy is coded.
I checked out the manual and it indicates that i should be able to pass an int value to BarsRequired. Since I didn't see BarsRequired as a definable option in the indicator properties window before applying, i tried to hard code it in. However, when i change the line "indicator.BarsRequired = BarsRequired;" to 0 or 1 and recompile as a new separate indicator, it doesn't actually save the 0 or 1 value. Instead it reverts back to the very same "BarsRequired;" value.
Comment
-
Sure this is just the stock VOL code. The problem I get is when i change line 76 to an int value. It seems to default back to BarsRequired. Since the VOL code cant be modified directly it has to be saved as something else which i've done
//
// Copyright (C) 2006, NinjaTrader LLC <www.ninjatrader.com>.
// NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
//
#region Using declarations
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
using System.Xml.Serialization;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
/// </summary>
[Description("Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).")]
public class VOL : Indicator
{
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(new Pen(Color.Blue, 2), PlotStyle.Bar, "Volume"));
Add(new Line(Color.DarkGray, 0, "Zero line"));
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
Value.Set(Volume[0]);
}
}
}
#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private VOL[] cacheVOL = null;
private static VOL checkVOL = new VOL();
/// <summary>
/// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
/// </summary>
/// <returns></returns>
public VOL VOL()
{
return VOL(Input);
}
/// <summary>
/// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
/// </summary>
/// <returns></returns>
public VOL VOL(Data.IDataSeries input)
{
if (cacheVOL != null)
for (int idx = 0; idx < cacheVOL.Length; idx++)
if (cacheVOL[idx].EqualsInput(input))
return cacheVOL[idx];
VOL indicator = new VOL();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
indicator.Input = input;
indicator.SetUp();
VOL[] tmp = new VOL[cacheVOL == null ? 1 : cacheVOL.Length + 1];
if (cacheVOL != null)
cacheVOL.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheVOL = tmp;
Indicators.Add(indicator);
return indicator;
}
}
}
// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.VOL VOL()
{
return _indicator.VOL(Input);
}
/// <summary>
/// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
/// </summary>
/// <returns></returns>
public Indicator.VOL VOL(Data.IDataSeries input)
{
return _indicator.VOL(input);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.VOL VOL()
{
return _indicator.VOL(Input);
}
/// <summary>
/// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
/// </summary>
/// <returns></returns>
public Indicator.VOL VOL(Data.IDataSeries input)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
return _indicator.VOL(input);
}
}
}
#endregion
Comment
-
That's the wrong place to change BarsRequired. Note the statement before that which says:
Code:[B][COLOR=blue]#region[/COLOR] NinjaScript generated code. Neither change nor remove.[/B] [B][COLOR=seagreen]// This namespace holds all indicators and is required. Do not change it.[/COLOR][/B]
Comment
-
One would have to change the VOL indicator to have the following statement:
Code:BarsRequired=0;
There is no reason for this not to be done, as VOL is not an indicator which depends on there being a certain number of bars extant before it can display a correct result, as some other indicators are, so I hereby request that this change be made to the NinjaTrader supported indicator for 7.0.
(It's a one-line change, so please tell me you can squeeze it in! Thanks.)Last edited by KBJ; 10-30-2010, 02:52 PM. Reason: Corrected BarsRequired value to be 0 instead of 1.
Comment
-
Originally posted by NinjaTrader_Ray View PostSet the chart property "Show unstable period." to a value of true. That should have the vol start to plot immediately.
However, since this option is found on the chart's Properties screen, it affects all indicators on the chart.
Not displaying the "unstable" period is useful for indicators like SMA(14) where results cannot be fully calculated until there are at least 14 bars. And this makes sense, since the results for the first 14 bars are only estimated, so in most cases of this type we wouldn't want those "unstable" values to be displayed.
But for the VOL indicator which has no properties (and thus no period), there is no unstable period (other than for perhaps the first bar, I don't know - you tell me), so why not make the VOL indicator always display a value (even for the oldest/leftmost bars on the chart), like is done for the price bars?
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by tonyfalzarano, 10-21-2024, 09:53 PM
|
2 responses
137 views
0 likes
|
Last Post
![]()
by DonnyJMiller
Today, 05:52 AM
|
||
Started by Marble, 03-20-2025, 05:00 AM
|
8 responses
48 views
0 likes
|
Last Post
|
||
Started by PopovDS, 03-21-2025, 10:05 AM
|
3 responses
38 views
0 likes
|
Last Post
|
||
Started by BideDeff, Today, 04:51 AM
|
0 responses
3 views
0 likes
|
Last Post
![]()
by BideDeff
Today, 04:51 AM
|
||
Started by ArialiefNervePain, Today, 04:30 AM
|
0 responses
4 views
0 likes
|
Last Post
![]() |
Comment