public override void Reset() { // we do this in reset so we can pickup the response id and keep our orders unique _idt = new IdTracker(ID); // prompt for parameters if specified ParamPrompt.Popup(this, true, !_prompt); }
public override void Reset() { // enable prompting of system parameters to user, // so they do not have to recompile to change things ParamPrompt.Popup(this, true, _black); Int32 numOfInterval = 1; BarInterval[] intervaltypes = new BarInterval[numOfInterval]; Int32[] intervalValues = new Int32[numOfInterval]; for (Int32 i = 0; i < numOfInterval; i++) { intervaltypes[i] = BarType; intervalValues[i] = NumItemPerBar; } _blt = new BarListTracker(intervalValues, intervaltypes); _blt.GotNewBar += new SymBarIntervalDelegate(blt_GotNewBar); GenericParamUpdateHelper.updateParam(this, GenericParameter, false); Hashtable TD_combinationInputParamTmp = new Hashtable(); TD_combinationInputParamTmp["lookbackperiod"] = _barsback; TD_combinationInputParamTmp["minmumsignallength"] = _barsback; _TD_combinationFromATSGlobalIndicator = new ATSGlobalIndicatorPersonal.TD_combination(); _TD_combinationFromATSGlobalIndicator.Param = TD_combinationInputParamTmp; _TD_combinationFromATSGlobalIndicator.Initializatin(); _isShutDown = false; TotalProfit = 0m; _pt.Clear(); }
public override void Reset() { // enable prompting of system parameters to user, // so they do not have to recompile to change things ParamPrompt.Popup(this, true, _black); Int32 numOfInterval = 1; BarInterval[] intervaltypes = new BarInterval[numOfInterval]; Int32[] intervalValues = new Int32[numOfInterval]; for (Int32 i = 0; i < numOfInterval; i++) { intervaltypes[i] = BarType; intervalValues[i] = NumItemPerBar; } _blt = new BarListTracker(intervalValues, intervaltypes); _blt.GotNewBar += new SymBarIntervalDelegate(blt_GotNewBar); #region <在策略中实现从外部文件读取参数> //传递优化参数或系统参数 GenericParamUpdateHelper.updateParam(this, GenericParameter, false); if (File.Exists(SMAExternalParam)) { DataTable paramTableInput = null; StreamReader sr = new StreamReader(SMAExternalParam, Encoding.GetEncoding("GB18030")); paramTableInput = CsvParser.Parse(sr, true); sr.Close(); foreach (DataRow dr in paramTableInput.Rows) { if (paramTableInput.Columns.Contains("key") && paramTableInput.Columns.Contains("value")) { string tmpKey = dr["key"].ToString(); string tmpValue = dr["value"].ToString(); if (tmpKey == "genericparam") { GenericParameter = tmpValue; } //传递外部参数 GenericParamUpdateHelper.updateParam(this, GenericParameter, false); } } } #endregion Hashtable SMAInputParamTmp = new Hashtable(); SMAInputParamTmp["lookbackperiod"] = _barsback; SMAInputParamTmp["minmumsignallength"] = 1; _SMAFromATSGlobalIndicator = new ATSGlobalIndicatorPersonal.SMA(); _SMAFromATSGlobalIndicator.Param = SMAInputParamTmp; _SMAFromATSGlobalIndicator.Initializatin(); _isShutDown = false; TotalProfit = 0m; _pt.Clear(); }
public GreyExit() { // here's how we prompt for parameters ParamPrompt.Popup(this); // set default bar interval based on user's selection blt.DefaultInterval = Interval; // definae names for our indicators Indicators = new string[] { "SMA", "Crossed?" }; }
public override void Reset() { // enable prompting of system parameters to user, // so they do not have to recompile to change things ParamPrompt.Popup(this, true, _black); // only build bars for user's interval blt = new BarListTracker(Interval); // only calculate on new bars blt.GotNewBar += new SymBarIntervalDelegate(blt_GotNewBar); }
public override void Reset() //对于新的一天来计算的时候要进行重置 { // enable prompting of system parameters to user, // so they do not have to recompile to change things ParamPrompt.Popup(this, true, _black); Int32 numOfInterval = 1; BarInterval[] intervaltypes = new BarInterval[numOfInterval]; Int32[] intervalValues = new Int32[numOfInterval]; for (Int32 i = 0; i < numOfInterval; i++) { intervaltypes[i] = BarType; intervalValues[i] = NumItemPerBar; } _blt = new BarListTracker(intervalValues, intervaltypes); _blt.GotNewBar += new SymBarIntervalDelegate(blt_GotNewBar); GenericParamUpdateHelper.updateParam(this, GenericParameter, false); Hashtable ShortSMAInputParamTmp = new Hashtable(); //对于SMA indicator进行更新,用今天重新计算的SMA,而不用昨天 Hashtable LongSMAInputParamTmp = new Hashtable(); ShortSMAInputParamTmp["lookbackperiod"] = _shortbarsback; LongSMAInputParamTmp["lookbackperiod"] = _shortbarsback + _incrementbarsback; ShortSMAInputParamTmp["minmumsignallength"] = _shortbarsback; LongSMAInputParamTmp["minmumsignallength"] = _shortbarsback + _incrementbarsback; _ShortSMAFromATSGlobalIndicator = new ATSGlobalIndicatorPersonal.SMA(); _LongSMAFromATSGlobalIndicator = new ATSGlobalIndicatorPersonal.SMA(); _ShortSMAFromATSGlobalIndicator.Param = ShortSMAInputParamTmp; _LongSMAFromATSGlobalIndicator.Param = LongSMAInputParamTmp; _ShortSMAFromATSGlobalIndicator.Initializatin(); _LongSMAFromATSGlobalIndicator.Initializatin(); // reset the parameters of ATR Hashtable ATRInputParamTmp = new Hashtable(); ATRInputParamTmp["lookbackperiod"] = _shortbarsback; ATRInputParamTmp["minmumsignallength"] = 14; _ATRFromATSGlobalIndicator = new ATSGlobalIndicatorPersonal.ATR(); _ATRFromATSGlobalIndicator.Param = ATRInputParamTmp; _ATRFromATSGlobalIndicator.Initializatin(); //--------------------------------------------------------- _isShutDown = false; TotalProfit = 0m; _pt.Clear(); if (_shortbarsback != 34 || _incrementbarsback != 84) { Console.WriteLine("yo hey"); } }
public override void Reset() { // get parameters from user if we're not running in auto ParamPrompt.Popup(this, !_auto, _auto); // create pairs tracker if not already if (pairs == null) { pairs = new PairsTracker(Asym, Bsym, RatioA2B, BasisPointEntry); pairs.SpreadOutsideBounds += new DecimalDelegate(pairs_SpreadOutsideBounds); } // subscribe to symbols sendbasket(new string[] { Asym, Bsym }); D("Subscribed to pair: [" + Asym + "," + Bsym + "]"); }
public SMAResponse(bool prompt) { // enable prompting of system parameters to user, // so they do not have to recompile to change things ParamPrompt.Popup(this, !prompt); // only build bars for user's interval blt = new BarListTracker(Interval); // only calculate on new bars blt.GotNewBar += new SymBarIntervalDelegate(blt_GotNewBar); // set our indicator names, in case we import indicators into R // or excel, or we want to view them in gauntlet or kadina Indicators = new string[] { "SMA" }; }
/// <summary> /// Reset the respose system /// </summary> public override void Reset() { // enable prompting of system parameters to user, // so they do not have to recompile to change things ParamPrompt.Popup(this, true, _black); // Initialize "_blt", the bar list tracker Initialize_blt(); // Update generic parameters GenericParamUpdateHelper.updateParam(this, GenericParameter, false); #if EXTERNAL_PARAM //传递优化参数或系统参数 GenericParamUpdateHelper.updateParam(this, GenericParameter, false); if (File.Exists(SMAExternalParam)) { DataTable paramTableInput = null; StreamReader sr = new StreamReader(SMAExternalParam, Encoding.GetEncoding("GB18030")); paramTableInput = CsvParser.Parse(sr, true); sr.Close(); foreach (DataRow dr in paramTableInput.Rows) { if (paramTableInput.Columns.Contains("key") && paramTableInput.Columns.Contains("value")) { string tmpKey = dr["key"].ToString(); string tmpValue = dr["value"].ToString(); if (tmpKey == "genericparam") { GenericParameter = tmpValue; } //传递外部参数 GenericParamUpdateHelper.updateParam(this, GenericParameter, false); } } } #endif //Initialize_Indicators(); // set to false to indicate the system is on _isShutDown = false; // clear total profit TotalProfit = 0m; // Clear all position _pt.Clear(); ResetIndicators(); LocalReset(); }
/// <summary> /// Reset the respose system /// </summary> public override void Reset() { // enable prompting of system parameters to user, // so they do not have to recompile to change things ParamPrompt.Popup(this, true, _black); // Initialize "_blt", the bar list tracker Initialize_blt(); // Update generic parameters GenericParamUpdateHelper.updateParam(this, GenericParameter, false); Initialize_Indicators(); // set to false to indicate the system is on _isShutDown = false; // clear total profit _totalprofit = 0m; // Clear all position _pt.Clear(); }
public OpenCancel() { // enable feature to prompt user ParamPrompt.Popup(this); }
public override void Reset() { ParamPrompt.Popup(this, true, false); base.Reset(); }
public OpenAsymetry() { // enable prompting of user for parameters ParamPrompt.Popup(this); }