yes.script is working fine.But not able to mark only the image i posted here.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
willium vix fix indicator
Collapse
X
-
Hello,
This would be because you have the indicator in Panel 2 and need to specify that the indicator needs to draw on the PricePanel rather than the Indicator Panel.
Please add the following to your Initialize method.
Code:protected override void Initialize() { DrawOnPricePanel = true; }
Please let me know if I may be of additional assistance.JesseNinjaTrader Customer Service
Comment
-
Originally posted by sumana.m View Posthi
that forloop should start checking from the 1st bar of the chart.any substitute macro defined in ninja ?
got error error calling onbar update method on log.
PHP Code:#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Willium Vix Fix -- Of tuple
/// </summary>
[Description("Willium Vix Fix -- Of tuple")]
public class WVF : Indicator
{
#region Variables
// Wizard generated variables
private int wVF_Period = 22; // Default setting for WVF_Period
private int stochD_Period = 14; // Default setting for StochD_Period
private int stochK_Period=7;
private int CustSmoothing=3;
private DataSeries CurVar_DS;
private DataSeries CurVar_StochK;
// User defined variables (add any user defined variables below)
#endregion
/// <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(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "WVFplot0"));
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "StockDplot"));
Overlay = false;
CurVar_DS = new DataSeries(this);
CurVar_StochK=new DataSeries(this);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
//CurRSI_DS.Set(RSI(periodRSI,0)[0]);
double LLV = MIN(Close, wVF_Period)[0];
double HHV = MAX(Close, wVF_Period)[0];
//WVF = (HHV (Close,22) - Low)/(HHV(Close,22))*100;
CurVar_DS.Set(100*((HHV-Low[0])/HHV));
//WVFplot0.Set(CurVar_DS[0]);
//StoK.Set(SMA(StoRSI_DS, periodK)[0]);
CurVar_StochK.Set(StochasticsFast(CurVar_DS,stochD_Period,stochK_Period/*,CustSmoothing*/).K[0]);
//CurVar_StochK.Set(Stochastics(CurVar_DS,stochD_Period,2).D[0]);
StockDplot.Set(CurVar_StochK[0]);
for(int i = 0; i< 10; i++)
{
DrawLine("myLine" + CurrentBar + i, 2, Low[0], 0, Low[0], Color.Red);
}
}
#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries WVFplot0
{
get { return Values[0]; }
}
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries StockDplot
{
get { return Values[1]; }
}
[Description("WVF works with two value 22 and 26")]
[GridCategory("Parameters")]
public int WVF_Period
{
get { return wVF_Period; }
set { wVF_Period = Math.Max(22, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int StochD_Period
{
get { return stochD_Period; }
set { stochD_Period = Math.Max(1, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int StochK_Period
{
get { return stochK_Period; }
set { stochK_Period = Math.Max(1, value); }
}
#endregion
}
}
#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 WVF[] cacheWVF = null;
private static WVF checkWVF = new WVF();
/// <summary>
/// Willium Vix Fix -- Of tuple
/// </summary>
/// <returns></returns>
public WVF WVF(int stochD_Period, int stochK_Period, int wVF_Period)
{
return WVF(Input, stochD_Period, stochK_Period, wVF_Period);
}
/// <summary>
/// Willium Vix Fix -- Of tuple
/// </summary>
/// <returns></returns>
public WVF WVF(Data.IDataSeries input, int stochD_Period, int stochK_Period, int wVF_Period)
{
if (cacheWVF != null)
for (int idx = 0; idx < cacheWVF.Length; idx++)
if (cacheWVF[idx].StochD_Period == stochD_Period && cacheWVF[idx].StochK_Period == stochK_Period && cacheWVF[idx].WVF_Period == wVF_Period && cacheWVF[idx].EqualsInput(input))
return cacheWVF[idx];
lock (checkWVF)
{
checkWVF.StochD_Period = stochD_Period;
stochD_Period = checkWVF.StochD_Period;
checkWVF.StochK_Period = stochK_Period;
stochK_Period = checkWVF.StochK_Period;
checkWVF.WVF_Period = wVF_Period;
wVF_Period = checkWVF.WVF_Period;
if (cacheWVF != null)
for (int idx = 0; idx < cacheWVF.Length; idx++)
if (cacheWVF[idx].StochD_Period == stochD_Period && cacheWVF[idx].StochK_Period == stochK_Period && cacheWVF[idx].WVF_Period == wVF_Period && cacheWVF[idx].EqualsInput(input))
return cacheWVF[idx];
WVF indicator = new WVF();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.StochD_Period = stochD_Period;
indicator.StochK_Period = stochK_Period;
indicator.WVF_Period = wVF_Period;
Indicators.Add(indicator);
indicator.SetUp();
WVF[] tmp = new WVF[cacheWVF == null ? 1 : cacheWVF.Length + 1];
if (cacheWVF != null)
cacheWVF.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheWVF = tmp;
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>
/// Willium Vix Fix -- Of tuple
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.WVF WVF(int stochD_Period, int stochK_Period, int wVF_Period)
{
return _indicator.WVF(Input, stochD_Period, stochK_Period, wVF_Period);
}
/// <summary>
/// Willium Vix Fix -- Of tuple
/// </summary>
/// <returns></returns>
public Indicator.WVF WVF(Data.IDataSeries input, int stochD_Period, int stochK_Period, int wVF_Period)
{
return _indicator.WVF(input, stochD_Period, stochK_Period, wVF_Period);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Willium Vix Fix -- Of tuple
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.WVF WVF(int stochD_Period, int stochK_Period, int wVF_Period)
{
return _indicator.WVF(Input, stochD_Period, stochK_Period, wVF_Period);
}
/// <summary>
/// Willium Vix Fix -- Of tuple
/// </summary>
/// <returns></returns>
public Indicator.WVF WVF(Data.IDataSeries input, int stochD_Period, int stochK_Period, int wVF_Period)
{
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.WVF(input, stochD_Period, stochK_Period, wVF_Period);
}
}
}
#endregion
Comment
-
Hi @koganam
Thanks for the participating in this discussion.
There is no syntactical error/logical just looking to filter out the trades get the marking in proper area. DrawOnBarPanel = true won't make any difference for now till in my end.
2nd part of the code could be getting last 30 bar's high and lows. (trying to work on it)Last edited by sumana.m; 12-24-2014, 09:56 AM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by arvidvanstaey, Today, 02:19 PM
|
3 responses
9 views
0 likes
|
Last Post Today, 03:23 PM | ||
Started by jordanq2, Today, 03:10 PM
|
2 responses
7 views
0 likes
|
Last Post
by jordanq2
Today, 03:23 PM
|
||
Started by traderqz, Today, 12:06 AM
|
10 responses
18 views
0 likes
|
Last Post
by traderqz
Today, 02:49 PM
|
||
Started by algospoke, 04-17-2024, 06:40 PM
|
5 responses
47 views
0 likes
|
Last Post Today, 02:36 PM | ||
Started by mmckinnm, Today, 01:34 PM
|
3 responses
7 views
0 likes
|
Last Post Today, 02:12 PM |
Comment