using System; using System.Collections.Generic; 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; namespace NinjaTrader.Indicator { public class i25m11s:Indicator { private const int MAX_DRAW_COUNT = 50000; // , COLOR_ALPHA_MIN = 50, COLOR_ALPHA_AMOUNT = 50; private float radiusStep = 2; private int drawCount = 0, thresholdPeriod = 100, thresholdStep = 10, drawObj = 0, lineLength1 = 1, bidAskMeanPeriod = 10, maxPeriod, drawBarsAgo = 0, mail = 0, mailMax = 0, mailCount = 0; private double thresholdHighMultiplier = 1.2, previousLevel = 0, bidAskMean; private string alertUse = "", mailFrom = "", mailTo = ""; private DateTime T0, T1; private int MDT = 0, MDTN, MDTN1, MDTS, MDTS1, MDT1; private double voltrade = 1, C0, C1, MDTV, MDTV1, MDRA = 0, MDRA1 = 0, MDRB = 0, MDRB1 = 0, MDRuse, sdc; private Boolean Tick_1 = false, LastObjectPlus = false, LastObjectMinus = false; private Color colorUse; private float deltaX; public string alertFilenameAsk = "зона_покупок.wav", alertFilenameBid = "зона_продаж.wav"; public Color colorAboveAsk = Color.Red, colorUnderBid = Color.Green; public int inform = 1, lineWidth = 6, ntt = 1, snos = 1, snosOtobr = 0, test = 0, lineLength = 4, debug = 0, Ntt, Snos, SnosOtobr; public double volTrade = 1, volTradeText = 1, VolTrade, VolTradeText, thresholdLow = 1, ostText = 1; //public DataSeries DS_MDTN, DS_MDRA, DS_MDRB, DS_MDTV, DS_MDTC, DS_MDTCB; DrawObject[] drawObjects = new DrawObject[MAX_DRAW_COUNT]; i14m16s MD;//SupRBidRAskMean; //LinReg bidMean, askMean; //RegressionChannel thresholdBid, thresholdAsk; class DrawObject { private DateTime time; private double price; private SolidBrush brush; private int level; public DrawObject ( DateTime time, double price, SolidBrush brush, int level ) { this.time = time; this.price = price; this.brush = brush; this.level = level; } public DateTime Time { get { return time; } } public double Price { get { return price; } } public SolidBrush Brush { get { return brush; } } public int Level { get { return level; } } } protected override void Initialize () { Add (PeriodType.Tick, 1); Overlay = true; DS_MDTN = new DataSeries (this); DS_MDRA = new DataSeries (this); DS_MDRB = new DataSeries (this); DS_MDTV = new DataSeries (this); DS_MDTC = new DataSeries (this); DS_MDTCB = new DataSeries (this); } protected override void OnStartUp () { MD = i14m16s (Inputs[1], thresholdPeriod, thresholdStep); //bidMean = LinReg(MD.Bid, bidAskMeanPeriod); //askMean = LinReg(MD.Ask, bidAskMeanPeriod); //bidAskMean = Math.Max(Convert.ToDouble(bidMean), Convert.ToDouble(askMean)); //if (CalculateOnBarClose) // drawBarsAgo = -1; CalculateOnBarClose = false; //! } protected override void OnBarUpdate () { if (BarsPeriod.Id == PeriodType.Tick && BarsPeriod.Value == 1) Tick_1 = true; else Tick_1 = false; drawCount++; if (drawCount < 4) return; if (BarsInProgress != 1) //* return; //if (BarsPeriod.Id == PeriodType.Tick && BarsPeriod.Value == 1 && BarsInProgress == 1) // return; /*if (CurrentBar < 10) { //Print ("25-5 CB=" + CurrentBar); return; }*/ //if (BarsInProgress == 1) // Бары основного ТФ убрать с графика // return; //if(Bars != null) { /*if (drawCount < 4) { Print ("25-5 dC=" + drawCount); return; }*/ //Print("i25m11s OnBarUpdate = " + (++ii).ToString()); //*if (Historical) //|| BarsInProgress != 1) //*return; //if (drawCount >= 2) { int sdv = 0; // 1 int sdvGraph = 0; // 1 if (Historical) { sdv = 0; // sdv = 2; sdvGraph = 0; // 1 } //sdv = 0; //sdvGraph = 0; //Print ("1"); //if (MD.TickNumber.ContainsValue (sdv) == false) // return; // Very important block of code //double Temp1 = MD.RestBid[0]; //double Temp2 = MD.RestAsk[0]; //Print ("25-5 T1=" + Temp1 + " T2=" + Temp2); //double Temp3 = MD.bDR[0]; //double Temp4 = MD.aDR[0]; //Print ("25-5 T1=" + Temp1 + " T2=" + Temp2 + " T3=" + Temp3 + " T4=" + Temp4); MDTN = Convert.ToInt32 (MD.TickNumber[sdv]); MDTS = Convert.ToInt32 (MD.TradeSnos[sdv]); MDT = Convert.ToInt32 (MD.Trade[sdv]); MDTV = MD.TradeVolume[sdv]; MDRB = MD.bDR[sdv]; MDRA = MD.aDR[sdv]; C0 = Close[sdv]; T0 = Time[sdv]; if (MDRB == C0) MDRB = 0; if (MDRA == C0) MDRA = 0; //if ((Time[0] > new DateTime (2015, 6, 10, 07, 16, 01)) && /*if ((MDRB > 5) || (MDRA > 5)) //|| Print ("25-7 T1=" + Time[sdv] + " " + Historical + " MDPR B0=" + MD.bDR[0] + " A0=" + MD.aDR[0] + " BIP=" + BarsInProgress); */ //Print ("26-2 A C1=" + Close[0] + " MDTN=" + MD.TickNumber[0] + // " MDTV=" + MD.TradeVolume[0] + " MDTS=" + MD.TradeSnos[0] + " MDT=" + MDT); //if (Time[0] == new DateTime (2015, 6, 10, 12, 19, 22)) // bool stop = true; if (((MDTN == 0) || (MDTN == 1)) && ((LastObjectPlus == true) || (LastObjectMinus == true))) { //if ((LastObjectPlus == true) || (LastObjectMinus == true)) { //if ((MDTN <= 1) && ((LastObjectPlus == true) || (LastObjectMinus == true))) { // Построение графиков //Print ("26-2 G CB=" + CurrentBar + " MDTN1=" + MDTN1 + // " MDTV1=" + MDTV1 + " MDTS1=" + MDTS1 + " MDT1=" + MDT1); if (test == 1) Print ("25-10 T0=" + Time[0] + " T1=" + Time[1].ToString ().Substring (11) + " C1=" + Close[1] + " " + Historical + " TN=" + MDTN1 + " TS=" + MDTS1 + " TV=" + MDTV1 + " B0=" + MDRB1 + " A0=" + MDRA1 + " BIP=" + BarsInProgress + " o"); if (LastObjectPlus == true) lineLength1 = Convert.ToInt32 (lineLength * MDRB1 / 1000F); if (LastObjectMinus == true) lineLength1 = Convert.ToInt32 (lineLength * MDRA1 / 1000F); if (lineLength1 == 0) lineLength1 = 1; int DL_startBarsAgo, DL_endBarsAgo, DT_barsAgo; if (Tick_1 == true) { DL_startBarsAgo = 1; DL_endBarsAgo = 1 - lineLength1; DT_barsAgo = 0; // -1; } else { if (Historical) { DL_startBarsAgo = -1; // 0 DL_endBarsAgo = -2 - lineLength1; // -1 DT_barsAgo = -4 - lineLength1; // -3 } else { // Real DL_startBarsAgo = 0; // 0 DL_endBarsAgo = -1 - lineLength1; // -1 DT_barsAgo = -3 - lineLength1; // -3 } } try { if (LastObjectPlus == true) { colorUse = colorUnderBid; MDRuse = MDRB1; sdc = C1 - TickSize; // 0.99996 * C1; alertUse = alertFilenameBid; LastObjectPlus = false; } else if (LastObjectMinus == true) { colorUse = colorAboveAsk; MDRuse = MDRA1; sdc = C1 + TickSize; // 1.00004 * C1; alertUse = alertFilenameAsk; LastObjectMinus = false; } DS_MDTN.Set (MDTN1); DS_MDRA.Set (MDRA1); DS_MDRB.Set (MDRB1); DS_MDTV.Set (MDTV1); DS_MDTC.Set (C1); DS_MDTCB.Set (CurrentBar); if (alertUse != "") Alert ("A25" + alertUse.ToString (), NinjaTrader.Cbi.Priority.Medium, "Ostatok " + colorUse.ToString (), alertUse, 10, Color.White, Color.Black); if (drawObj >= (MAX_DRAW_COUNT - 1)) { Print ("25-11 dC=" + drawObj); return; } drawObjects[drawObj] = new i25m11s.DrawObject ( T1, C1, new SolidBrush (Color.FromArgb (150, colorUse)), Convert.ToInt32 (MDRuse)); drawObj++; if (debug >= 1) { // Режим отладки DrawLine ("L25" + drawCount.ToString (), true, //0, C1, -lineLength1, C1, DL_startBarsAgo, C1, DL_endBarsAgo, C1, //drawBarsAgo + sdvGraph + 1, C1, 2 - lineLength1, C1, //Color.Green, DashStyle.Solid, lineWidth); Color.Black, DashStyle.Solid, lineWidth); // colorUse if ((inform == 1) && (MDRuse >= ostText)) { DrawText("T25" + drawCount.ToString(), true, "o" + MDRuse.ToString(), DT_barsAgo, sdc, 0, Color.Black, // colorUse, new Font (FontFamily.GenericSansSerif, 8.0F, FontStyle.Bold), StringAlignment.Far, Color.Transparent, Color.White, 0); } } if ((mail == 1) && (mailCount <= mailMax) && (MDRuse >= ostText)) { // Отсылка электронных сообщений ++mailCount; SendMail (mailFrom, mailTo, "Индикатор 26, остаток " + MDRuse.ToString() + ", цвет " + colorUse.ToString(), // Заголовок "Сообщение " + mailCount.ToString () + ", индикатор 26, остаток " + MDRuse.ToString () + ", цвет " + colorUse.ToString()); // Сообщение } } catch (Exception ex) { //if (this.Print == null) // return; Print (ex.ToString ()); } } //else { // Фильтрация по минимальному объему остатка //Print ("ELSE"); if (MDRB >= thresholdLow) { //Print ("ELOP"); LastObjectPlus = true; MDRB1 = MDRB; MDRA1 = 0; } else if (MDRA >= thresholdLow) { //Print ("ELOM"); LastObjectMinus = true; MDRA1 = MDRA; MDRB1 = 0; } // Сохраняем значения для следующего прохода с построением графика C1 = C0; T1 = T0; MDTN1 = MDTN; MDTV1 = MDTV; MDTS1 = MDTS; MDT1 = MDT; } public override void Plot ( Graphics graphics, Rectangle bounds, double min, double max ) { try { base.Plot (graphics, bounds, min, max); if (debug == 2) return; SmoothingMode oldSmoothingMode = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.AntiAlias; if (drawObj >= MAX_DRAW_COUNT) return; for (int i = 0; i < drawObj; i++) { //if (drawObjects[i] == null) // return; if (drawObjects[i] != null) { //if (CurrentBar >= (Bars.Count - 34)) // return; //Print ("Plot 1 " + i + " " + drawObjects[i].Time + " " + drawObjects[i].Price + // " " + CurrentBar + " " + Bars.Count); float x = ChartControl.GetXByBarIdx (Bars, Bars.GetBar (drawObjects[i].Time)); float y = 0; /*if ((drawObjects[i].Price > min + TickSize) && (drawObjects[i].Price < max - TickSize)) { //y = ChartControl.GetYByValue (BarsArray[0], drawObjects[i].Price); y = ChartControl.GetYByValue (Bars, drawObjects[i].Price); } else return; */ y = ChartControl.GetYByValue (Bars, drawObjects[i].Price); //Print ("Plot 2 " + i + " " + drawObjects[i].Time + " " + drawObjects[i].Price + " " + Bars); deltaX = (lineLength * drawObjects[i].Level / 100); graphics.FillRectangle (drawObjects[i].Brush, x, y - lineWidth / 2, deltaX, lineWidth); // DL_startBarsAgo, C1, DL_endBarsAgo, C1, //Print (x + " " + deltaX + " " + y + " " + lineWidth); if (inform == 1) { if (drawObjects[i].Level >= ostText) { /*DrawText ("DT25" + i.ToString (), true, "o" + drawObjects[i].Level.ToString (), CurrentBar - Bars.GetBar (drawObjects[i].Time) - 2, drawObjects[i].Price, 0, Color.Black, // drawObjects[i].Brush.Color, new Font (FontFamily.GenericSansSerif, 8.0F, FontStyle.Bold), StringAlignment.Center, Color.Transparent, Color.White, 0);*/ StringFormat format1 = new StringFormat (StringFormatFlags.NoClip); format1.Alignment = StringAlignment.Center; graphics.DrawString ("o" + drawObjects[i].Level.ToString (), new Font (FontFamily.GenericSansSerif, 8.0F, FontStyle.Bold), drawObjects[i].Brush, x + deltaX + 12, y - 8, format1); } } } // if (drawObjects[i] != null) } // for graphics.SmoothingMode = oldSmoothingMode; } catch (Exception ex) { //if (this.Print == null) // return; Print (ex.ToString ()); } } #region Parameters [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Звук оповещения Bid")] [Description ("Название wav-файла для оповещения Bid'ы \"ушли\"")] public string AlertFilenameBid { get { return alertFilenameBid; } set { alertFilenameBid = value; } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Звук оповещения Ask")] [Description ("Название wav-файла для оповещения Ask'и \"ушли\"")] public string AlertFilenameAsk { get { return alertFilenameAsk; } set { alertFilenameAsk = value; } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Линия длина")] [Description ("Длина линии - используется как множитель")] public int LineLength { get { return lineLength; } set { lineLength = Math.Max (1, value); } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Линия толщина")] [Description ("Толщина линии - используется как реальное значение (интервал от 1 до 10)")] public int LineWidth { get { return lineWidth; } set { lineWidth = Math.Max (1, value); lineWidth = Math.Min (10, lineWidth); } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Остаток объем")] [Description ("Минимальный объем остатка для отображения")] public double ThresholdLow { get { return thresholdLow; } set { thresholdLow = value; } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Отладка (0-2)")] [Description ("Режим отладки (0-нет, 1-да, 2-да, но основная визуализация отключена)")] public int Debug { get { return debug; } set { debug = Math.Max (0, value); debug = Math.Min (2, debug); } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Сообщения (1-0)")] [Description ("Электронные сообщения Mail включить (1-да, 0-нет)")] public int Mail { get { return mail; } set { mail = Math.Max (0, value); mail = Math.Min (1, mail); } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Сообщения кому")] [Description ("Почтовый ящик, в который посылаются сообщения")] public string MailTo { get { return mailTo; } set { mailTo = value; } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Сообщения максимум")] [Description ("Максимальное число электронных сообщений Mail, посланных за сеанс работы NT. Необходимо учитывать, что у каждого провайдера определено максимальное число сообщений, при превышении которого передача блокируется.")] public int MailMax { get { return mailMax; } set { mailMax = Math.Max (0, value); mailMax = Math.Min (1000, mailMax); } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Сообщения от кого")] [Description ("Почтовый ящик, из которого посылаются сообщения. Данные настройки должны соответствовать параметрам, заданным в меню Tools - Options - Misc")] public string MailFrom { get { return mailFrom; } set { mailFrom = value; } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Текст (1-0)")] [Description ("Текстовое отображение объема остатка (1-да, 0-нет)")] public int Inform { get { return inform; } set { inform = Math.Max (0, value); inform = Math.Min (1, inform); } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Текст объем остатка")] [Description ("Минимальный объем остатка для текстового отображения")] public double OstText { get { return ostText; } set { ostText = Math.Max (1, value); } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Тестирование (1-0)")] [Description ("Листинг для тестирования выводится в окно Output (1-да, 0-нет)")] public int Test { get { return test; } set { test = Math.Max (0, value); test = Math.Min (1, test); } } [XmlIgnore ()] [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Цвет области Ask")] [Description ("Цвет области цен равных или выше Ask")] public Color ColorAboveAsk { get { return colorAboveAsk; } set { colorAboveAsk = (Color) value; } } [Browsable (false)] public string ColorAboveAskSerialize { get { return Gui.Design.SerializableColor.ToString (colorAboveAsk); } set { colorAboveAsk = Gui.Design.SerializableColor.FromString (value); } } [XmlIgnore ()] [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Цвет области Bid")] [Description ("Цвет области цен равных или ниже Bid")] public Color ColorUnderBid { get { return colorUnderBid; } set { colorUnderBid = (Color) value; } } [Browsable (false)] public string ColorUnderBidSerialize { get { return Gui.Design.SerializableColor.ToString (colorUnderBid); } set { colorUnderBid = Gui.Design.SerializableColor.FromString (value); } } [XmlIgnore ()] public DataSeries DS_MDTN, DS_MDRA, DS_MDRB, DS_MDTV, DS_MDTC, DS_MDTCB; #region Parameters Not Use /*[GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Не используется - Период")] [Description ("Период для сглаживания i14")] public int BidAskMeanPeriod { get { return bidAskMeanPeriod; } set { bidAskMeanPeriod = Math.Max (1, value); } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("14 - Период")] [Description ("Период для расчёта уровня i14")] public int ThresholdPeriod { get { return thresholdPeriod; } set { thresholdPeriod = Math.Max (1, value); } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("14 - Шаг")] [Description ("Шаг для расчёта уровня i14")] public int ThresholdStep { get { return thresholdStep; } set { thresholdStep = Math.Max (1, value); } } [GridCategory ("Параметры")] [Gui.Design.DisplayNameAttribute ("Не используется - Верхняя граница, множитель")] [Description ("Множитель для расчёта верхней границы. " + "Например, 1.2 - 20%")] public double ThresholdHighMultiplier { get { return thresholdHighMultiplier; } set { thresholdHighMultiplier = Math.Max (0.001, value); } }*/ #endregion #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 i25m11s[] cachei25m11s = null; private static i25m11s checki25m11s = new i25m11s (); /// /// /// /// public i25m11s i25m11s ( string alertFilenameAsk, string alertFilenameBid, Color colorAboveAsk, Color colorUnderBid, int inform, int lineWidth, int ntt, int snos, int snosOtobr, int test, double volTrade, double volTradeText, double thresholdLow, double ostText, int lineLength, int debug ) { //int bidAskMeanPeriod, int lineLength, double thresholdHighMultiplier, double thresholdLow, //int thresholdPeriod, int thresholdStep ) { return i25m11s (Input, alertFilenameAsk, alertFilenameBid, colorAboveAsk, colorUnderBid, inform, lineWidth, ntt, snos, snosOtobr, test, volTrade, volTradeText, thresholdLow, ostText, lineLength, debug); //bidAskMeanPeriod, lineLength, thresholdHighMultiplier, thresholdLow, //thresholdPeriod, thresholdStep); } /// /// /// /// public i25m11s i25m11s ( Data.IDataSeries input, string alertFilenameAsk, string alertFilenameBid, Color colorAboveAsk, Color colorUnderBid, int inform, int lineWidth, int ntt, int snos, int snosOtobr, int test, double volTrade, double volTradeText, double thresholdLow, double ostText, int lineLength, int debug ) { //int bidAskMeanPeriod, int lineLength, double thresholdHighMultiplier, double thresholdLow, //int thresholdPeriod, int thresholdStep ) { if (cachei25m11s != null) for (int idx = 0; idx < cachei25m11s.Length; idx++) if (cachei25m11s[idx].AlertFilenameAsk == alertFilenameAsk && cachei25m11s[idx].AlertFilenameBid == alertFilenameBid && cachei25m11s[idx].ColorAboveAsk == colorAboveAsk && cachei25m11s[idx].ColorUnderBid == colorUnderBid && Math.Abs (cachei25m11s[idx].Inform - inform) <= double.Epsilon && Math.Abs (cachei25m11s[idx].LineWidth - lineWidth) <= double.Epsilon && Math.Abs (cachei25m11s[idx].Ntt - ntt) <= double.Epsilon && Math.Abs (cachei25m11s[idx].Snos - snos) <= double.Epsilon && Math.Abs (cachei25m11s[idx].SnosOtobr - snosOtobr) <= double.Epsilon && Math.Abs (cachei25m11s[idx].Test - test) <= double.Epsilon && Math.Abs (cachei25m11s[idx].VolTrade - volTrade) <= double.Epsilon && Math.Abs (cachei25m11s[idx].VolTradeText - volTradeText) <= double.Epsilon && /*cachei25m11s[idx].BidAskMeanPeriod == bidAskMeanPeriod && Math.Abs (cachei25m11s[idx].ThresholdHighMultiplier - thresholdHighMultiplier) <= double.Epsilon && Math.Abs (cachei25m11s[idx].ThresholdLow - thresholdLow) <= double.Epsilon &&*/ //cachei25m11s[idx].ThresholdPeriod == thresholdPeriod && //cachei25m11s[idx].ThresholdStep == thresholdStep && Math.Abs (cachei25m11s[idx].ThresholdLow - thresholdLow) <= double.Epsilon && Math.Abs (cachei25m11s[idx].OstText - ostText) <= double.Epsilon && cachei25m11s[idx].LineLength == lineLength && cachei25m11s[idx].Debug == debug && cachei25m11s[idx].EqualsInput (input)) return cachei25m11s[idx]; lock (checki25m11s) { checki25m11s.AlertFilenameAsk = alertFilenameAsk; alertFilenameAsk = checki25m11s.AlertFilenameAsk; checki25m11s.AlertFilenameBid = alertFilenameBid; alertFilenameBid = checki25m11s.AlertFilenameBid; checki25m11s.ColorAboveAsk = colorAboveAsk; colorAboveAsk = checki25m11s.ColorAboveAsk; checki25m11s.ColorUnderBid = colorUnderBid; colorUnderBid = checki25m11s.ColorUnderBid; checki25m11s.Inform = inform; inform = checki25m11s.Inform; checki25m11s.LineWidth = lineWidth; lineWidth = checki25m11s.LineWidth; checki25m11s.Ntt = ntt; ntt = checki25m11s.Ntt; checki25m11s.Snos = snos; snos = checki25m11s.Snos; checki25m11s.SnosOtobr = snosOtobr; snosOtobr = checki25m11s.SnosOtobr; checki25m11s.Test = test; test = checki25m11s.Test; checki25m11s.VolTrade = volTrade; volTrade = checki25m11s.VolTrade; checki25m11s.VolTradeText = volTradeText; volTradeText = checki25m11s.VolTradeText; checki25m11s.LineLength = lineLength; lineLength = checki25m11s.LineLength; checki25m11s.ThresholdLow = thresholdLow; thresholdLow = checki25m11s.ThresholdLow; checki25m11s.OstText = ostText; ostText = checki25m11s.OstText; checki25m11s.Debug = debug; debug = checki25m11s.Debug; /*checki25m11s.BidAskMeanPeriod = bidAskMeanPeriod; bidAskMeanPeriod = checki25m11s.BidAskMeanPeriod; checki25m11s.ThresholdHighMultiplier = thresholdHighMultiplier; thresholdHighMultiplier = checki25m11s.ThresholdHighMultiplier; checki25m11s.ThresholdPeriod = thresholdPeriod; thresholdPeriod = checki25m11s.ThresholdPeriod; checki25m11s.ThresholdStep = thresholdStep; thresholdStep = checki25m11s.ThresholdStep;*/ if (cachei25m11s != null) for (int idx = 0; idx < cachei25m11s.Length; idx++) if (cachei25m11s[idx].AlertFilenameAsk == alertFilenameAsk && cachei25m11s[idx].AlertFilenameBid == alertFilenameBid && cachei25m11s[idx].ColorAboveAsk == colorAboveAsk && cachei25m11s[idx].ColorUnderBid == colorUnderBid && cachei25m11s[idx].Inform == inform && cachei25m11s[idx].LineWidth == lineWidth && cachei25m11s[idx].Ntt == ntt && cachei25m11s[idx].Snos == snos && cachei25m11s[idx].SnosOtobr == snosOtobr && cachei25m11s[idx].Test == test && cachei25m11s[idx].VolTrade == volTrade && cachei25m11s[idx].VolTradeText == volTradeText && Math.Abs (cachei25m11s[idx].ThresholdLow - thresholdLow) <= double.Epsilon && Math.Abs (cachei25m11s[idx].OstText - ostText) <= double.Epsilon && cachei25m11s[idx].LineLength == lineLength && cachei25m11s[idx].Debug == debug && /*cachei25m11s[idx].BidAskMeanPeriod == bidAskMeanPeriod && Math.Abs (cachei25m11s[idx].ThresholdHighMultiplier - thresholdHighMultiplier) <= double.Epsilon && //cachei25m11s[idx].ThresholdPeriod == thresholdPeriod && //cachei25m11s[idx].ThresholdStep == thresholdStep && */ cachei25m11s[idx].EqualsInput (input)) return cachei25m11s[idx]; i25m11s indicator = new i25m11s (); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.AlertFilenameAsk = alertFilenameAsk; indicator.AlertFilenameBid = alertFilenameBid; indicator.ColorAboveAsk = colorAboveAsk; indicator.ColorUnderBid = colorUnderBid; indicator.Inform = inform; indicator.LineWidth = lineWidth; indicator.Ntt = ntt; indicator.Snos = snos; indicator.SnosOtobr = snosOtobr; indicator.Test = test; indicator.VolTrade = volTrade; indicator.VolTradeText = volTradeText; indicator.ThresholdLow = thresholdLow; indicator.LineLength = lineLength; indicator.OstText = ostText; indicator.Debug = debug; /*indicator.BidAskMeanPeriod = bidAskMeanPeriod; indicator.ThresholdHighMultiplier = thresholdHighMultiplier; indicator.ThresholdPeriod = thresholdPeriod; indicator.ThresholdStep = thresholdStep;*/ Indicators.Add (indicator); indicator.SetUp (); i25m11s[] tmp = new i25m11s[cachei25m11s == null ? 1 : cachei25m11s.Length + 1]; if (cachei25m11s != null) cachei25m11s.CopyTo (tmp, 0); tmp[tmp.Length - 1] = indicator; cachei25m11s = 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 { /// /// /// /// [Gui.Design.WizardCondition ("Indicator")] public Indicator.i25m11s i25m11s ( string alertFilenameAsk, string alertFilenameBid, Color colorAboveAsk, Color colorUnderBid, int inform, int lineWidth, int ntt, int snos, int snosOtobr, int test, double volTrade, double volTradeText, double thresholdLow, double ostText, int lineLength, int debug ) { //int bidAskMeanPeriod, int lineLength, double thresholdHighMultiplier, double thresholdLow, //int thresholdPeriod, int thresholdStep ) { return _indicator.i25m11s (Input, alertFilenameAsk, alertFilenameBid, colorAboveAsk, colorUnderBid, inform, lineWidth, ntt, snos, snosOtobr, test, volTrade, volTradeText, thresholdLow, ostText, lineLength, debug); //bidAskMeanPeriod, lineLength, thresholdHighMultiplier, thresholdLow, //thresholdPeriod, thresholdStep); } /// /// /// /// public Indicator.i25m11s i25m11s ( Data.IDataSeries input, string alertFilenameAsk, string alertFilenameBid, Color colorAboveAsk, Color colorUnderBid, int inform, int lineWidth, int ntt, int snos, int snosOtobr, int test, double volTrade, double volTradeText, double thresholdLow, double ostText, int lineLength, int debug ) { //int bidAskMeanPeriod, int lineLength, double thresholdHighMultiplier, double thresholdLow, //int thresholdPeriod, int thresholdStep ) { return _indicator.i25m11s (input, alertFilenameAsk, alertFilenameBid, colorAboveAsk, colorUnderBid, inform, lineWidth, ntt, snos, snosOtobr, test, volTrade, volTradeText, thresholdLow, ostText, lineLength, debug); //bidAskMeanPeriod, lineLength, thresholdHighMultiplier, thresholdLow, //thresholdPeriod, thresholdStep); } } } // This namespace holds all strategies and is required. Do not change it. namespace NinjaTrader.Strategy { public partial class Strategy:StrategyBase { /// /// /// /// [Gui.Design.WizardCondition ("Indicator")] public Indicator.i25m11s i25m11s ( string alertFilenameAsk, string alertFilenameBid, Color colorAboveAsk, Color colorUnderBid, int inform, int lineWidth, int ntt, int snos, int snosOtobr, int test, double volTrade, double volTradeText, double thresholdLow, double ostText, int lineLength, int debug ) { //int bidAskMeanPeriod, int lineLength, double thresholdHighMultiplier, double thresholdLow, //int thresholdPeriod, int thresholdStep ) { return _indicator.i25m11s (Input, alertFilenameAsk, alertFilenameBid, colorAboveAsk, colorUnderBid, inform, lineWidth, ntt, snos, snosOtobr, test, volTrade, volTradeText, thresholdLow, ostText, lineLength, debug); //bidAskMeanPeriod, lineLength, thresholdHighMultiplier, thresholdLow, //thresholdPeriod, thresholdStep); } /// /// /// /// public Indicator.i25m11s i25m11s ( Data.IDataSeries input, string alertFilenameAsk, string alertFilenameBid, Color colorAboveAsk, Color colorUnderBid, int inform, int lineWidth, int ntt, int snos, int snosOtobr, int test, double volTrade, double volTradeText, double thresholdLow, double ostText, int lineLength, int debug ) { //int bidAskMeanPeriod, int lineLength, double thresholdHighMultiplier, double thresholdLow, //int thresholdPeriod, int thresholdStep ) { 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.i25m11s (input, alertFilenameAsk, alertFilenameBid, colorAboveAsk, colorUnderBid, inform, lineWidth, ntt, snos, snosOtobr, test, volTrade, volTradeText, thresholdLow, ostText, lineLength, debug); //bidAskMeanPeriod, lineLength, thresholdHighMultiplier, thresholdLow, //thresholdPeriod, thresholdStep); } } } #endregion