Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Exported using NT Version 6.5.1000.6
Description
This is a moving average created by Igorad from the Trend Laboratory and Forex-TSD forums.
It has very low lag when the market is trending and is usually flat when the market is ranging.
Change Log
Updates …
i'm looking to code it for SC but i'm not able to reproduce it.
Has someone already code it and willing to share
thanks
Can you help answer these questions from other members on NexusFi?
Hi,
I tried the Step Ma (Compiled the cpp file to dll), but I can't even get close to what it should look like, the inputs are also not working :-( Not sure why..
It would be great if someone can recode the StepMA that TheWizard has coded. That is perfect..
Here is the code for NT-- I am not sure how to change it to SierraChart
#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
#region enums
/**********************************************************************/
/* CHANGE LOG */
/* 09-11-08 mrLogik */
/* - Initial Release */
/* 09-12-08 mrLogik */
/* - Changed MA_MODE SMA option to MA / Weighted */
/* 09-12-08 whitegun */
/* - Allow kV Input minimum value to be 0 rather than 1 */
/* - Allow Percentage Input to be positive or negative */
/* -12-11-09 Zondor use multiple colored single plot for NT7 */
/* September 8, 2013 TheWizard */
/* - added ColorMode "3" to allow for coloring the line based on */
/* open and close being above or below the line. If both open */
/* and close of current bar are above the line, color the line */
/* the selected UP color. If both open and close of current bar */
/* are below the line, color the line the selected DOWN color. */
/* else, color the line the selected NEUTRAL color. Also added */
/* the option to color the price bars based on the color of the */
/* SetpMA line. */
/**********************************************************************/
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
[Description("Enter the description of your new custom indicator here")]
public class StepMaV72Sharky : Indicator
{
//Inputs
private int lastbar,startbar,lastcalcbar;
private int lastBar,firstBar,b;
private double trunc;
private bool Treasury;
// private string priceMarker; // commented out by Silvester17 to decrease right price margin Feb 26, 2014
private string Nn;
private double hValue=0;
private int fraction;
private decimal fractional;
private int plot0Width = 2;
private PlotStyle plot0Style = PlotStyle.Line;
private DashStyle dash0Style = DashStyle.Solid;
private Color downColor = Color.Red;
private Color upColor = Color.CornflowerBlue;
private Color neutralColor = Color.White;
private Color prevcolor = Color.Yellow;
private double buffer;
private int iLength = 10; // Moving Average Length
private int iStepSize = 11; // Constant StepSize (if needed)
private int iTenthPip = 2; // MBT Users should set this to 10 for (1/10)th Pip Granularity
private MAAverageType iAverageType = MAAverageType.WMA; // Moving Average Type
double iKv = 0.4; // Sensivity Factor
double iPercentage = 0; // Percentage of Up/Down Moving
bool iHighLow = true; // High/Low Mode Switch (more sensitive)
int iColorMode = 2; // Color Mode Switch
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
this.Name = "Step MA V72";
//Don't include current bar ?? (i = 1)
for (int i = 1 ; i <= iLen ; i++)
{
if (iAverageType == MAAverageType.SMA)
alfa= 1.0;
else
alfa = 1.0 * (iLen - i) / iLen;
[Description("Line Width for Plot")]
[Category("Plot Attributes")]
[Gui.Design.DisplayNameAttribute("Line Width")]
public int Plot0Width
{
get { return plot0Width; }
set { plot0Width = Math.Max(1, value); }
}
/// <summary>
/// </summary>
[Description("PlotStyle for Plot")]
[Category("Plot Attributes")]
[Gui.Design.DisplayNameAttribute("PlotStyle")]
public PlotStyle Plot0Style
{
get { return plot0Style; }
set { plot0Style = value; }
}
/// <summary>
/// </summary>
[Description("DashStyle for Plot")]
[Category("Plot Attributes")]
[Gui.Design.DisplayNameAttribute("DashStyle")]
public DashStyle Dash0Style
{
get { return dash0Style; }
set { dash0Style = value; }
}
[XmlIgnore()]
[Description("Color for Neutral Plot")]
[Category("Plots-Colors")]
public Color ColorNeutral
{
get { return neutralColor; }
set { neutralColor = value; }
}
// Serialize our Color object
[Browsable(false)]
public string ColorNeutralSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString(neutralColor); }
set { neutralColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
}
[XmlIgnore()]
[Description("Color for Falling Plot")]
[Category("Plots-Colors")]
public Color ColorFalling
{
get { return downColor; }
set { downColor = value; }
}
// Serialize our Color object
[Browsable(false)]
public string ColorFallingSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString(downColor); }
set { downColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
}
[XmlIgnore()]
[Description("Color for Rising Plot")]
[Category("Plots-Colors")]
public Color ColorRising
{
get { return upColor; }
set { upColor = value; }
}
[Browsable(false)]
public string ColorRisingSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString(upColor); }
set { upColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
}
[Description("iLength")]
[Category("Parameters")]
public int Length
{
get { return iLength; }
set { iLength = Math.Max(1, value); }
}
[Description("iStepSize")]
[Category("Parameters")]
public int StepSize
{
get { return iStepSize; }
set { iStepSize = Math.Max(0, value); }
}
[Description("TenthPip. Set to 10 for MBT users, otherwise 1")]
[Category("Parameters")]
public int TenthPip
{
get { return iTenthPip; }
set { iTenthPip = Math.Max(1, value); }
}
[Description("Moving Average Type")]
[Category("Parameters")]
public MAAverageType MAType
{
get { return iAverageType; }
set { iAverageType = value; }
}
[Description("iKv")]
[Category("Parameters")]
public double Kv
{
get { return iKv; }
set { iKv = Math.Max(0, value); }
}
[Description("iPercentage")]
[Category("Parameters")]
public double Percentage
{
get { return iPercentage; }
set { iPercentage = value; }
}
[Description("iHighLow")]
[Category("Parameters")]
public bool HighLow
{
get { return iHighLow; }
set { iHighLow = value; }
}
[Description("iColorMode (1, 2 or 3)")]
[Category("Parameters")]
public int ColorMode
{
get { return iColorMode; }
set { iColorMode = Math.Max(0, value); }
}
// added by TheWizard September 8, 2013
[Description("Color Price Bars?")]
[Category("Plots-Colors")]
public bool Colorbars
{
get { return colorbars; }
set { colorbars = value; }
}
[Description("Arrows?")]
[Category("Plots-Colors")]
public bool Arrows
{
get { return arrows; }
set { arrows = 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 StepMaV72Sharky[] cacheStepMaV72Sharky = null;
private static StepMaV72Sharky checkStepMaV72Sharky = new StepMaV72Sharky();
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public StepMaV72Sharky StepMaV72Sharky(int colorMode, bool highLow, double kv, int length, MAAverageType mAType, double percentage, int stepSize, int tenthPip)
{
return StepMaV72Sharky(Input, colorMode, highLow, kv, length, mAType, percentage, stepSize, tenthPip);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public StepMaV72Sharky StepMaV72Sharky(Data.IDataSeries input, int colorMode, bool highLow, double kv, int length, MAAverageType mAType, double percentage, int stepSize, int tenthPip)
{
if (cacheStepMaV72Sharky != null)
for (int idx = 0; idx < cacheStepMaV72Sharky.Length; idx++)
if (cacheStepMaV72Sharky[idx].ColorMode == colorMode && cacheStepMaV72Sharky[idx].HighLow == highLow && Math.Abs(cacheStepMaV72Sharky[idx].Kv - kv) <= double.Epsilon && cacheStepMaV72Sharky[idx].Length == length && cacheStepMaV72Sharky[idx].MAType == mAType && Math.Abs(cacheStepMaV72Sharky[idx].Percentage - percentage) <= double.Epsilon && cacheStepMaV72Sharky[idx].StepSize == stepSize && cacheStepMaV72Sharky[idx].TenthPip == tenthPip && cacheStepMaV72Sharky[idx].EqualsInput(input))
return cacheStepMaV72Sharky[idx];
// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.StepMaV72Sharky StepMaV72Sharky(int colorMode, bool highLow, double kv, int length, MAAverageType mAType, double percentage, int stepSize, int tenthPip)
{
return _indicator.StepMaV72Sharky(Input, colorMode, highLow, kv, length, mAType, percentage, stepSize, tenthPip);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.StepMaV72Sharky StepMaV72Sharky(Data.IDataSeries input, int colorMode, bool highLow, double kv, int length, MAAverageType mAType, double percentage, int stepSize, int tenthPip)
{
return _indicator.StepMaV72Sharky(input, colorMode, highLow, kv, length, mAType, percentage, stepSize, tenthPip);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.StepMaV72Sharky StepMaV72Sharky(int colorMode, bool highLow, double kv, int length, MAAverageType mAType, double percentage, int stepSize, int tenthPip)
{
return _indicator.StepMaV72Sharky(Input, colorMode, highLow, kv, length, mAType, percentage, stepSize, tenthPip);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.StepMaV72Sharky StepMaV72Sharky(Data.IDataSeries input, int colorMode, bool highLow, double kv, int length, MAAverageType mAType, double percentage, int stepSize, int tenthPip)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");