Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Ninja ElliottOscillator Editing Question
Collapse
X
-
Hello raptureye,
It looks like the other item is fairly simple and is just a few plots in addition to the calculation. I went ahead and moved this over to an NT8 script as there was really no conversion needed here, just the correct NT8 syntax modifications were needed.
Please let me know if I may be of further assistance.
Attached Files
Leave a comment:
-
Hi Jesse, of course so thank you, I appreciate what you can find out on y'all's end!
Leave a comment:
-
Hello raptureye,
I will take a look into this item to see if it can be converted into NT8 format. Once I have more details I will reply back here.
I do want to mention that conversions are not a service that our support offers but it looks like Bertrand had previously uploaded an indicator named "EWO2.cs" which I can review to see about an NT8 version.
I look forward to being of further assistance.
Leave a comment:
-
Right, that's file I sent you, but it seems it's not the one you actually then chart? You seen to call the UpDn variation?
Leave a comment:
-
I posted exactly what you had...try this link (not sure how to attach a pic directly...asks for link to image with no other choice...thanks
//
// Copyright (C) 2006, NinjaTrader LLC <[email protected]>.
// 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>
/// Elliot Oscillator
/// </summary>
[Description("The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.")]
[Gui.Design.DisplayName("Elliot Oscillator")]
public class ElliotOscillator2 : Indicator
{
#region Variables
private int fast = 5;
private int slow = 34;
private double elliot = 0;
private double elliot3 = 0;
private DataSeries fastEma;
private DataSeries slowEma;
#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.Transparent, "Elliot"));
Add(new Plot(new Pen(Color.Blue, 3), PlotStyle.Bar, "UpTrend"));
Add(new Plot(new Pen(Color.Red, 3), PlotStyle.Bar, "DownTrend"));
Add(new Plot(Color.Red, "Elliot Displaced"));
Add(new Line(Color.DarkGray, 0, "Zero line"));
fastEma = new DataSeries(this);
slowEma = new DataSeries(this);
CalculateOnBarClose = true;
PriceTypeSupported = true;
AutoScale = true;
}
/// <summary>
/// Calculates the indicator value(s) at the current index.
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBar < 3)
return;
if (CurrentBar == 0)
{
fastEma.Set(Input[0]);
slowEma.Set(Input[0]);
Value.Set(0);
Elliott3.Set(0);
}
else
{
fastEma.Set(SMA(fast)[0]);
slowEma.Set(SMA(slow)[0]);
elliot = ((fastEma[0] - slowEma[0]));
elliot3 = ((fastEma[3] - slowEma[3]));
Value.Set(elliot);
Elliott3.Set(elliot3);
if (Value[0] > 0)
Uptrend.Set(elliot);
else if (Value[0] < 0)
Downtrend.Set(elliot);
}
}
#region Properties
/// <summary>
/// </summary>
[Browsable(false)]
[XmlIgnore()]
public DataSeries Default
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore()]
public DataSeries Uptrend
{
get { return Values[1]; }
}
[Browsable(false)]
[XmlIgnore()]
public DataSeries Downtrend
{
get { return Values[2]; }
}
/// <summary>
/// </summary>
[Browsable(false)]
[XmlIgnore()]
public DataSeries Elliott3
{
get { return Values[3]; }
}
/// <summary>
/// </summary>
[Description("Number of bars for fast SMA")]
[Category("Parameters")]
public int Fast
{
get { return fast; }
set { fast = Math.Max(1, value); }
}
/// <summary>
/// </summary>
[Description("Number of bars for slow SMA")]
[Category("Parameters")]
public int Slow
{
get { return slow; }
set { slow = 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 ElliotOscillator2[] cacheElliotOscillator2 = null;
private static ElliotOscillator2 checkElliotOscillator2 = new ElliotOscillator2();
/// <summary>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
public ElliotOscillator2 ElliotOscillator2(int fast, int slow)
{
return ElliotOscillator2(Input, fast, slow);
}
/// <summary>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
public ElliotOscillator2 ElliotOscillator2(Data.IDataSeries input, int fast, int slow)
{
if (cacheElliotOscillator2 != null)
for (int idx = 0; idx < cacheElliotOscillator2.Length; idx++)
if (cacheElliotOscillator2[idx].Fast == fast && cacheElliotOscillator2[idx].Slow == slow && cacheElliotOscillator2[idx].EqualsInput(input))
return cacheElliotOscillator2[idx];
lock (checkElliotOscillator2)
{
checkElliotOscillator2.Fast = fast;
fast = checkElliotOscillator2.Fast;
checkElliotOscillator2.Slow = slow;
slow = checkElliotOscillator2.Slow;
if (cacheElliotOscillator2 != null)
for (int idx = 0; idx < cacheElliotOscillator2.Length; idx++)
if (cacheElliotOscillator2[idx].Fast == fast && cacheElliotOscillator2[idx].Slow == slow && cacheElliotOscillator2[idx].EqualsInput(input))
return cacheElliotOscillator2[idx];
ElliotOscillator2 indicator = new ElliotOscillator2();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.Fast = fast;
indicator.Slow = slow;
Indicators.Add(indicator);
indicator.SetUp();
ElliotOscillator2[] tmp = new ElliotOscillator2[cacheElliotOscillator2 == null ? 1 : cacheElliotOscillator2.Length + 1];
if (cacheElliotOscillator2 != null)
cacheElliotOscillator2.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheElliotOscillator2 = 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>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.ElliotOscillator2 ElliotOscillator2(int fast, int slow)
{
return _indicator.ElliotOscillator2(Input, fast, slow);
}
/// <summary>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
public Indicator.ElliotOscillator2 ElliotOscillator2(Data.IDataSeries input, int fast, int slow)
{
return _indicator.ElliotOscillator2(input, fast, slow);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.ElliotOscillator2 ElliotOscillator2(int fast, int slow)
{
return _indicator.ElliotOscillator2(Input, fast, slow);
}
/// <summary>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
public Indicator.ElliotOscillator2 ElliotOscillator2(Data.IDataSeries input, int fast, int slow)
{
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.ElliotOscillator2(input, fast, slow);
}
}
}
#endregion
Leave a comment:
-
Sorry Brian, we could not access those screenshots you post? Can you please directly attach here? Did you use the exact version that I posted?
Leave a comment:
-
here is a screenshot...it does not seem to working as same color above and below zero line and neutral is transparent...thanks
C:\Users\brian\Downloads\cs_file2.png
Leave a comment:
-
Correct my apologies, there was the neutral series still defined in the properties of the indicator actually so you could run into an array issue as you had seen, the version attached will fix that. For the coloring this will use the two plots, however you may also switch colors over using NT7's PlotColors approach -
Attached Files
Leave a comment:
-
thanks. here's a screen shot of what i got.
C:\Users\brian\SkyDrive\Public\cs_file_ninja.png
One thing is neutral is there...just transparent
The other thing is that what I would like is one color if oscillator is above zero line and one color if it is below zero line...this is still using uptrend and downtrend
thank you so much for all your help...
Leave a comment:
-
Please give the attached a try, I think it should visualize what you seeked.Attached Files
Leave a comment:
-
I copied what you have and it still doesn't work (no log errors)...thanks
C:\Users\brian\SkyDrive\Public\EWOaa.png
//
// Copyright (C) 2006, NinjaTrader LLC <[email protected]>.
// 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>
/// Elliot Oscillator
/// </summary>
[Description("The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.")]
[Gui.Design.DisplayName("Elliot Oscillator")]
public class EWOaa : Indicator
{
#region Variables
private int fast = 5;
private int slow = 34;
private double elliot = 0;
private double elliot3 = 0;
private DataSeries fastEma;
private DataSeries slowEma;
#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.Transparent, "Elliot"));
Add(new Plot(new Pen(Color.Black, 3), PlotStyle.Bar, "Neutral"));
Add(new Plot(new Pen(Color.Blue, 3), PlotStyle.Bar, "UpTrend"));
Add(new Plot(new Pen(Color.Red, 3), PlotStyle.Bar, "DownTrend"));
Add(new Plot(Color.Red, "Elliot Displaced"));
Add(new Line(Color.DarkGray, 0, "Zero line"));
fastEma = new DataSeries(this);
slowEma = new DataSeries(this);
CalculateOnBarClose = true;
PriceTypeSupported = true;
AutoScale = true;
}
/// <summary>
/// Calculates the indicator value(s) at the current index.
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBar < 3)
return;
{
fastEma.Set(Input[0]);
slowEma.Set(Input[0]);
Value.Set(0);
Elliott3.Set(0);
fastEma.Set(SMA(fast)[0]);
slowEma.Set(SMA(slow)[0]);
elliot = ((fastEma[0] - slowEma[0]));
elliot3 = ((fastEma[3] - slowEma[3]));
Value.Set(elliot);
Elliott3.Set(elliot3);
if (Value[0] > 0)
Uptrend.Set(elliot);
else if (Value[0] < 0)
Downtrend.Set(elliot);
}
}
#region Properties
/// <summary>
/// </summary>
[Browsable(false)]
[XmlIgnore()]
public DataSeries Default
{
get { return Values[0]; }
}
/// <summary>
/// </summary>
[Browsable(false)]
[XmlIgnore()]
public DataSeries Neutral
{
get { return Values[1]; }
}
[Browsable(false)]
[XmlIgnore()]
public DataSeries Uptrend
{
get { return Values[2]; }
}
[Browsable(false)]
[XmlIgnore()]
public DataSeries Downtrend
{
get { return Values[3]; }
}
/// <summary>
/// </summary>
[Browsable(false)]
[XmlIgnore()]
public DataSeries Elliott3
{
get { return Values[4]; }
}
/// <summary>
/// </summary>
[Description("Number of bars for fast SMA")]
[Category("Parameters")]
public int Fast
{
get { return fast; }
set { fast = Math.Max(1, value); }
}
/// <summary>
/// </summary>
[Description("Number of bars for slow SMA")]
[Category("Parameters")]
public int Slow
{
get { return slow; }
set { slow = 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 EWOaa[] cacheEWOaa = null;
private static EWOaa checkEWOaa = new EWOaa();
/// <summary>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
public EWOaa EWOaa(int fast, int slow)
{
return EWOaa(Input, fast, slow);
}
/// <summary>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
public EWOaa EWOaa(Data.IDataSeries input, int fast, int slow)
{
if (cacheEWOaa != null)
for (int idx = 0; idx < cacheEWOaa.Length; idx++)
if (cacheEWOaa[idx].Fast == fast && cacheEWOaa[idx].Slow == slow && cacheEWOaa[idx].EqualsInput(input))
return cacheEWOaa[idx];
lock (checkEWOaa)
{
checkEWOaa.Fast = fast;
fast = checkEWOaa.Fast;
checkEWOaa.Slow = slow;
slow = checkEWOaa.Slow;
if (cacheEWOaa != null)
for (int idx = 0; idx < cacheEWOaa.Length; idx++)
if (cacheEWOaa[idx].Fast == fast && cacheEWOaa[idx].Slow == slow && cacheEWOaa[idx].EqualsInput(input))
return cacheEWOaa[idx];
EWOaa indicator = new EWOaa();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.Fast = fast;
indicator.Slow = slow;
Indicators.Add(indicator);
indicator.SetUp();
EWOaa[] tmp = new EWOaa[cacheEWOaa == null ? 1 : cacheEWOaa.Length + 1];
if (cacheEWOaa != null)
cacheEWOaa.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheEWOaa = 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>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.EWOaa EWOaa(int fast, int slow)
{
return _indicator.EWOaa(Input, fast, slow);
}
/// <summary>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
public Indicator.EWOaa EWOaa(Data.IDataSeries input, int fast, int slow)
{
return _indicator.EWOaa(input, fast, slow);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.EWOaa EWOaa(int fast, int slow)
{
return _indicator.EWOaa(Input, fast, slow);
}
/// <summary>
/// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
/// </summary>
/// <returns></returns>
public Indicator.EWOaa EWOaa(Data.IDataSeries input, int fast, int slow)
{
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.EWOaa(input, fast, slow);
}
}
}
#endregion
Leave a comment:
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by jpkulkarni, Today, 10:12 PM
|
0 responses
2 views
0 likes
|
Last Post
by jpkulkarni
Today, 10:12 PM
|
||
Started by jpkulkarni, Today, 09:27 PM
|
0 responses
4 views
0 likes
|
Last Post
by jpkulkarni
Today, 09:27 PM
|
||
Started by Scalper888, Yesterday, 05:09 PM
|
5 responses
23 views
0 likes
|
Last Post
by Scalper888
Today, 06:43 PM
|
||
Started by CardozoPeggy, Today, 06:01 PM
|
0 responses
3 views
0 likes
|
Last Post
by CardozoPeggy
Today, 06:01 PM
|
||
Started by aaaa7389, Today, 05:33 PM
|
0 responses
4 views
0 likes
|
Last Post
by aaaa7389
Today, 05:33 PM
|
Leave a comment: