protected override void Initialize() { halfPeriodHigh = CreateDataSeries(); halfPeriodLow = CreateDataSeries(); filter = CreateDataSeries(); highLowRange1 = CreateDataSeries(); highLowRange2 = CreateDataSeries(); stddev = Indicators.StandardDeviation(Source, period, MovingAverageType.Simple); }
protected override void Initialize() { halfPeriodHigh = CreateDataSeries(); halfPeriodLow = CreateDataSeries(); filter = CreateDataSeries(); highLowRange1 = CreateDataSeries(); highLowRange2 = CreateDataSeries(); stddev = Indicators.StandardDeviation(Source, period, MovingAverageType.Simple); }
protected override void Initialize() { // Initialize and create nested indicators movingAverage = Indicators.MovingAverage(Source, Period, MaType); standardDeviation = Indicators.StandardDeviation(Source, Period, MaType); }
protected override void Initialize() { // Initialize and create nested indicators movingAverage = Indicators.MovingAverage(Source, Period, MaType); standardDeviation = Indicators.StandardDeviation(Source, Period, MaType); }
// func() protected override void OnStart() { // demonstrate using indicators easier to compute in pre-build cAlgo // code than to compute in the external system. //rsiBase = Indicators.RelativeStrengthIndex(DataSeries, RSIPeriod); rsi = Indicators.RelativeStrengthIndex(Source, RSIPeriod); stdDev = Indicators.StandardDeviation(Source, RSIPeriod, MovingAverageType.Simple); var ticktype = MarketSeries.TimeFrame.ToString(); fiName = DataDir + "\\" + "exp-" + Symbol.Code + "-" + ticktype + "-rsi" + RSIPeriod + "-stddev" + StdDevPeriod + "-bars.csv"; Print("fiName=" + fiName); if (System.IO.Directory.Exists(DataDir) == false) { System.IO.Directory.CreateDirectory(DataDir); } if (System.IO.File.Exists(fiName) == false) { // generate new file with CSV header only if // one does not already exist. System.IO.File.WriteAllText(fiName, csvhead); } else { maxDate = get_most_recent_date(fiName); } Print("maxDate=" + maxDate); // had to open file this way to prevent .net from locking it and preventing // access by other processes when using to download live ticks. fstream = File.Open(fiName, FileMode.Open, FileAccess.Write, FileShare.ReadWrite); // setup to append to end of file Print("File is Open"); fstream.Seek(0, SeekOrigin.End); // write stream has to be created after seek due to .net wierdness // creating with 0 prevents buffering since we want tick data // to be available to consumers right away. fwriter = new System.IO.StreamWriter(fstream, System.Text.Encoding.UTF8, 1); // QUESTION: How to tell when in Backtest mode so we // can create the stream with a large buffer and turn off // auto flush to improve IO performance. Print("Fwriter is created"); fwriter.AutoFlush = true; // with autoflush true will autocleanup // since we can not close since we may run forever Print("done onStart()"); }
protected override void Initialize() { _movingAverage = Indicators.MovingAverage(Price, Period, MaType); _standardDeviation = Indicators.StandardDeviation(Price, Period, MaType); }
protected override void Initialize() { _movingAverage = Indicators.MovingAverage(Price, Period, MaType); _standardDeviation = Indicators.StandardDeviation(Price, Period, MaType); }