Esempio n. 1
0
        private void SignalObject_onScriptParameters(object sender, ScriptParametersEvent e)
        {
            __cOrderService = e.OrderService;
            __cParameters   = e.ScriptParameters;

            int           iCount = __cParameters.Count;
            List <string> sArgs  = __cProfile.Parameters;

            if (sArgs == null && iCount > 0)
            {
                ShowScriptParameters();
            }
            else
            {
                if (__bForceShowParameters)
                {
                    __bForceShowParameters = false;
                    ShowScriptParameters();
                }
                else
                {
                    try {
                        for (int i = 0; i < iCount; i++)
                        {
                            __cParameters[i].SetValue(sArgs[i]);
                        }

                        __cSignalObject.UpdateParameters();
                    } catch {
                        ShowScriptParameters();
                    }
                }
            }
        }
Esempio n. 2
0
		internal override void CStudyInitialize() {
			if (__cProperty.OrderSource != null) {
				IInstrument cBars0 = this.Bars;
				CreateTrader(cBars0, null);  //建立交易服務元件
				SelectTrader(cBars0.Request.Symbol);  //選擇作用中的交易服務元件
			}

			List<InputAttribute> cParameters = new List<InputAttribute>();
			cParameters.AddRange(InputAttribute.GetParameters(this));
			
			if (__cOrderService != null) {
				cParameters.AddRange(InputAttribute.GetParameters(__cOrderService));
			}

			ScriptParametersEvent cScriptParametersEvent = new ScriptParametersEvent();
			cScriptParametersEvent.SetOrderService(__cOrderService);
			cScriptParametersEvent.SetScriptParameters(cParameters);
			OnScriptParameters(cScriptParametersEvent);

			if (__cOrderService != null) {
				__cOrderService.Initialize();  //參數設定完成之後才初始化下單元件
			}
		}
Esempio n. 3
0
		/// <summary>
		///   載入腳本後觸發腳本使用者自訂參數事件(將腳本參數利用此事件傳遞到外部)
		/// </summary>
		/// <param name="e">腳本初始化事件</param>
		internal void OnScriptParameters(ScriptParametersEvent e) {
			if (onScriptParameters != null) {
				onScriptParameters(this, e);
			}
		}