Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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>
- /// lower low then privous and better finish
- /// </summary>
- [Description("lower low then privous and better finish")]
- public class bottomReversal : Indicator
- {
- #region Variables
- // Wizard generated variables
- private int myInput0 = 1; // Default setting for MyInput0
- // 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.TriangleUp, "Plot0"));
- Overlay = true;
- }
- /// <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.
- if (CurrentBar <2) return;
- Value.Set(Math.Sign(Low[0]-Low[1])>Math.Sign(Low[1]-Low[2])? Low[1]:0);
- }
- #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 Plot0
- {
- get { return Values[0]; }
- }
- [Description("")]
- [GridCategory("Parameters")]
- public int MyInput0
- {
- get { return myInput0; }
- set { myInput0 = 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 bottomReversal[] cachebottomReversal = null;
- private static bottomReversal checkbottomReversal = new bottomReversal();
- /// <summary>
- /// lower low then privous and better finish
- /// </summary>
- /// <returns></returns>
- public bottomReversal bottomReversal(int myInput0)
- {
- return bottomReversal(Input, myInput0);
- }
- /// <summary>
- /// lower low then privous and better finish
- /// </summary>
- /// <returns></returns>
- public bottomReversal bottomReversal(Data.IDataSeries input, int myInput0)
- {
- if (cachebottomReversal != null)
- for (int idx = 0; idx < cachebottomReversal.Length; idx++)
- if (cachebottomReversal[idx].MyInput0 == myInput0 && cachebottomReversal[idx].EqualsInput(input))
- return cachebottomReversal[idx];
- lock (checkbottomReversal)
- {
- checkbottomReversal.MyInput0 = myInput0;
- myInput0 = checkbottomReversal.MyInput0;
- if (cachebottomReversal != null)
- for (int idx = 0; idx < cachebottomReversal.Length; idx++)
- if (cachebottomReversal[idx].MyInput0 == myInput0 && cachebottomReversal[idx].EqualsInput(input))
- return cachebottomReversal[idx];
- bottomReversal indicator = new bottomReversal();
- indicator.BarsRequired = BarsRequired;
- indicator.CalculateOnBarClose = CalculateOnBarClose;
- #if NT7
- indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
- indicator.MaximumBarsLookBack = MaximumBarsLookBack;
- #endif
- indicator.Input = input;
- indicator.MyInput0 = myInput0;
- Indicators.Add(indicator);
- indicator.SetUp();
- bottomReversal[] tmp = new bottomReversal[cachebottomReversal == null ? 1 : cachebottomReversal.Length + 1];
- if (cachebottomReversal != null)
- cachebottomReversal.CopyTo(tmp, 0);
- tmp[tmp.Length - 1] = indicator;
- cachebottomReversal = 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>
- /// lower low then privous and better finish
- /// </summary>
- /// <returns></returns>
- [Gui.Design.WizardCondition("Indicator")]
- public Indicator.bottomReversal bottomReversal(int myInput0)
- {
- return _indicator.bottomReversal(Input, myInput0);
- }
- /// <summary>
- /// lower low then privous and better finish
- /// </summary>
- /// <returns></returns>
- public Indicator.bottomReversal bottomReversal(Data.IDataSeries input, int myInput0)
- {
- return _indicator.bottomReversal(input, myInput0);
- }
- }
- }
- // This namespace holds all strategies and is required. Do not change it.
- namespace NinjaTrader.Strategy
- {
- public partial class Strategy : StrategyBase
- {
- /// <summary>
- /// lower low then privous and better finish
- /// </summary>
- /// <returns></returns>
- [Gui.Design.WizardCondition("Indicator")]
- public Indicator.bottomReversal bottomReversal(int myInput0)
- {
- return _indicator.bottomReversal(Input, myInput0);
- }
- /// <summary>
- /// lower low then privous and better finish
- /// </summary>
- /// <returns></returns>
- public Indicator.bottomReversal bottomReversal(Data.IDataSeries input, int myInput0)
- {
- 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.bottomReversal(input, myInput0);
- }
- }
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement