i've included all the variables and stuff below, I would appreciate any help.
#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; using System.Collections.Generic; //using System.Data; //using System.Drawing; using System.Linq; using System.Text; using System.Windows; using System.Windows.Forms; using System.IO; using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; #endregion // This namespace holds all indicators and is required. Do not change it. namespace NinjaTrader.Indicator { /// <summary> /// Shows stats based on VP /// </summary> [Description("Shows stats based on VP")] public class VPModel : Indicator { #region Variables // Wizard generated variables // User defined variables (add any user defined variables below) public Form1 form1; private bool rightSession = false; //from writevpmodel private TimeSpan startTime,endTime; private double deviationValueN; private bool error = false; private bool wrongSession = false; #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() { Overlay = true; CalculateOnBarClose = true; Add(PeriodType.Minute,1);//1 } protected override void OnStartUp(){ //Window window = lbxWindows.SelectedItem as Window; form1 = new Form1(this,TickSize);//window); form1.Show(); VPModelObject vpModel = new VPModelObject(Instrument.FullName); form1.setModel(vpModel,new DayGroup(writevpmodel_OnStartUp())); } public void drawLevel(DayLevels d,bool on){ i ChartControl.ParentForm.Activate(); } public void drawMM(DayLevels d, bool on){ ChartControl.ParentForm.Activate(); } private bool RTHSession,IBBroken,firstHour,OSFound,OSLowFound,OSHighFound,first15; private double high_,open_,low_,close_,volume_,rel_high,rel_low,IBVPOC; private double IBHigh,IBLow,OSHigh,OSLow, IBLowBroken,IBHighBroken; double m15Low = double.MaxValue; double m15High = double.MinValue; Dictionary<double, double> histogram ; double histogramMax; double tickSize; int state; string sessionName; TimeSpan sessionStart; private bool inSession, drawSession; private DateTime startTS ; int dayNumber; private List<DayLevels> writevpmodel_OnStartUp(){ String name = Instrument.FullName.Substring(0,2); double price = 0; int len = Times[barNumber].Count; TimeSpan currentTime = Times[barNumber][-len].TimeOfDay; bool RTHPrevSession = false; int startI = 0; double maxKey = -1; bool first = true; return days; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { TimeSpan currentTime = Times[barNumber][0].TimeOfDay; } protected override void OnTermination(){ form1.Dispose(true); } public void scrollMe(double ts){ DateTime t = DateTime.ParseExact(ts.ToString("00000000000000"),"yyyyMMddHHmmss",System.Globalization.CultureInfo.InvariantCulture); int intFirstBarOnChart = Time.Count - FirstBarIndexPainted; int distance = LastBarIndexPainted - FirstBarIndexPainted; } } public class DayLevels{ public double open,high, low, close, volume,vpoc; public int number;//this is the day number to know which days coem before / after public int type; public const int EVE = 0; public const int ON = 1; public const int RTH = 2; public const int ETH = 3; public double ibhigh,iblow,ibvpoc; } public class DayGroup{ List<DayLevels> days; bool foundEVE = false, foundON = false; int count = 0; int dayCount = 0; public const int EVE = 0; public const int ON = 1; public const int RTH = 2; public const int ETH = 3; public const int PRTH = 4; private Dictionary<int,int> LUT = new Dictionary<int,int>(); } public class VPModelObject{ public VPGroup EVE,ON,ETH; public VPGroupStats vps = new VPGroupStats(); private Dictionary<string,Dictionary<int,double>> data = new Dictionary<string,Dictionary<int,double>>(); private Dictionary<string,Dictionary<int,bool>> parameters = new Dictionary<string,Dictionary<int,bool>>(); string filename = name + "VPModel.csv"; string filePath = @"C:\Users\rajiv\Documents\NinjaTrader 7\" + filename; data.Add("ETHhigh",new Dictionary<int,double>()); } } public class VPJoined{ public HashSet<int> hashSet;//has the user calculated results public List<VPInput> list = new List<VPInput>(); private string[] generators = new String[] {"loc","range","gap"}; private string[] name; private int type; private VPGroupRow vpgr; private double total; private bool needToOrder = true; private List<int> order; //the mean / median / mode only matter for this group } public class VPJoinedO{//for IB Both Broken public HashSet<int> hashSet;//has the user calculated results private List<VPOutput> list = new List<VPOutput>(); private VPJoined vpj; string[] generators; private int type; private double numberBetween; } public class VPGroup{ VPJoined vpj; VPJoinedO vpjo; VPOutput breakHi,breakLo; } public class VPGroupStats{ private Dictionary<string,VPOutput> vpo = new Dictionary<string,VPOutput>(); private Dictionary<string,VPJoinedO> vpj = new Dictionary<string,VPJoinedO>(); } public struct VPSessionResult{ public double high,low,and,or,onlyHi,onlyLo; public VPGroupRow row,all;//contains the loc, range, gap values } public class VPOutput{ private double min,max,median,total,numberBetween; private int type; public SortedList<int,double> values = new SortedList<int,double>();//values and indices of matches private VPJoined vpJoined; Dictionary<int,double> columnL,columnG,columnM; private string[] generators; public const int yCrossAbove = 1, yCrossBelow = 2, yPCrossAbove = 3, yPCrossBelow = 4,yPGreater = 5, yPLess = 6; } public double getTotal(){ return this.total; } public double getNumberBetween(){ return this.numberBetween; } } public class VPInput{ private string generators;//holds the data columns used to calculate this VPColumn private int type;//this defines the formula type to calculte the VPColumn public List<int> values = new List<int>();//has the indices that match user results private Dictionary<int,double> column;//reference to data in VPModel public double numberBetween,total; private VPGroupRow vpgr; } public struct VPGroupRow{ public double median; public double max; public double min; public double number; public double percent; } public class VPColumn{ //holds each data type public VPColumn(){} public bool get(string name,int index){ return true; } } public partial class Form1 : Form { private VPModel vp; private VPModelObject vpo; private double tickSize; private string sformat; public DayGroup dg; string filePath = @"C:\Users\rajiv\Documents\NinjaTrader 7\parameters.csv"; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> this.components = new System.ComponentModel.Container(); this.EVErangeH = new System.Windows.Forms.NumericUpDown(); this.EVErangeL = new System.Windows.Forms.NumericUpDown(); private System.Windows.Forms.Label OSHiBrokenV; private System.Windows.Forms.Label IBLowBrokenV; private System.Windows.Forms.Label CloseAboveIBMMH; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.Button LoadButton; } }
Comment