Esempio n. 1
0
        /// <summary>
        /// 创建指标
        /// </summary>
        /// <param name="id">编号</param>
        /// <param name="script">脚本</param>
        /// <param name="xml">XML</param>
        /// <returns>指标</returns>
        public static FCScript createIndicator(String id, String script, FCUIXml xml)
        {
            FCScript indicator = new FCScript();

            indicator.Name = id;
            FCDataTable table = new FCDataTable();

            indicator.DataSource = table;
            NFunctionBase.addFunctions(indicator);
            NFunctionUI.addFunctions(indicator, xml);
            NFunctionWin.addFunctions(indicator);
            int index = STARTINDEX;

            String[] functions     = FUNCTIONS.Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            int      functionsSize = functions.Length;

            for (int i = 0; i < functionsSize; i++)
            {
                indicator.addFunction(new NFunctionEx(indicator, index + i, functions[i], xml));
            }
            indicator.Script = script;
            table.addColumn(0);
            table.set(0, 0, 0);
            indicator.onCalculate(0);
            return(indicator);
        }
Esempio n. 2
0
        /// <summary>
        /// 添加方法
        /// </summary>
        /// <param name="indicator">方法库</param>
        /// <param name="native">脚本</param>
        /// <param name="xml">XML</param>
        /// <returns>指标</returns>
        public static void addFunctions(FCScript indicator, FCNative native)
        {
            string[] functions     = FUNCTIONS.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            int      functionsSize = functions.Length;

            for (int i = 0; i < functionsSize; i++)
            {
                indicator.addFunction(new NFunctionBase(indicator, STARTINDEX + i, PREFIX + functions[i], native));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 创建指标
        /// </summary>
        /// <param name="native">方法库</param>
        /// <param name="script">脚本</param>
        /// <returns>指标</returns>
        public static FCScript CreateScript(String script, FCNative native)
        {
            FCScript    indicator = new FCScript();
            FCDataTable table     = new FCDataTable();

            indicator.DataSource = table;
            CFunctionBase.addFunctions(indicator);
            CFunctionHttp.addFunctions(indicator);
            int index = STARTINDEX;

            string[] functions     = FUNCTIONS.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            int      functionsSize = functions.Length;

            for (int i = 0; i < functionsSize; i++)
            {
                indicator.addFunction(new CFunctionEx(indicator, index + i, functions[i], native));
            }
            indicator.Script = script;
            table.addColumn(0);
            table.set(0, 0, 0);
            indicator.onCalculate(0);
            return(indicator);
        }