C:\Users\brian\Downloads\cs_file2.png
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Ninja ElliottOscillator Editing Question
Collapse
X
-
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
-
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
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.JesseNinjaTrader Customer Service
Comment
-
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 FilesJesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by thedude, 11-14-2021, 08:44 AM
|
5 responses
531 views
0 likes
|
Last Post
by jmschmidt357
Today, 05:48 PM
|
||
Started by lorien, 08-08-2021, 07:33 AM
|
10 responses
711 views
0 likes
|
Last Post
by AndyM871
Today, 05:25 PM
|
||
Started by henann, Today, 04:47 PM
|
0 responses
2 views
0 likes
|
Last Post
by henann
Today, 04:47 PM
|
||
Started by zstheorist, 11-23-2024, 09:06 AM
|
3 responses
19 views
0 likes
|
Last Post Today, 04:06 PM | ||
Started by Ousher, 02-07-2022, 07:37 PM
|
6 responses
456 views
0 likes
|
Last Post
by nelslynn
Today, 03:53 PM
|
Comment