  
- UID
- 2
- 积分
- 2940714
- 威望
- 1420393 布
- 龙e币
- 1520321 刀
- 在线时间
- 13696 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2025-4-15

|
2、多个private文件:- //***********************************************************************************TEST头文件类变量(开始)
- //下面勿动即可
- private:
- int numod = 0;
- HWND hwnd;
- string t1, t2, t3, t4, t0; //关于时间的变量,在策略中会用到
- //在交易界面设置时传递的变量(开始)*****************************************
- string sName; //在策略中可以直接调用到策略运行面板中本策略的设计的名称
- string sPeriod; //可以在策略中调用到本策略运行面板设置的跑策略bar的周期
- string sInst; //可以在策略中调用的策略运行面板中的本策略的品种
- //在交易界面设置时传递的变量(结束)*****************************************
- //下面勿动即可
- //map结构设计开始
- map<string, CThostFtdcDepthMarketDataField>mapMd;
- map<string, CThostFtdcInstrumentField>mapInstrument;
- map<string, CThostFtdcOrderField>mapOrder;
- map<string, CThostFtdcTradeField>mapTrade;
- map<string, map<string, TPOSITION>>mapPos;
- map<string, CThostFtdcTradingAccountField>mapAcc;
- map<string, map<string, TKVALUE>>mapReal;
- map<string, double>mapSub;
- map <string, map<string, map<string, TKVALUE>>>mapK;
- map<string, TDETAIL> mapPosDeta;
- map<string, map<string, TCOMMISSION>>mapCom;
- map<int, string>maps; // 日志信息
- //map结构设计结束
- //交易相关的变量设计开始
- //下面勿动即可
- private:
- int n = 0;
- map<string, TDLLPARM>parm;
- list<string>lst;
- list<string>lstActionOrdrSysID;
- list<string>lstbeigenOrdrSysID;
- bool IsActionOrdrSysID(string orderid);
- bool IsbeigenOrdrSysID(string orderid);
- string state = "stop";
- string path = "D:\\data\\log";
- void OnState(string s);
- void end();
- void tend(TDLLPARM t);
- void SubscribeMarketData(string s);
- void OrderInsert(string acc, string inst, char bs, char oc, int volume, double price, string forfok, string ref2);
- void OrderAction(CThostFtdcOrderField t);
- void RsqBar(string period, string inst);
- void InsertLog(string msg);
- void RsqInstrument(string inst);
- void RsqRspQryOrder();
- void RsqRspQryTrade();
- void RsqPosition();
- void RsqPositionDetail(string acc);
- void RsqCommissionRate();
- void RsqAccount();
- void sound(string s);
- //委托与交易相关变量传递**************************************开始
- void chedan();
- void shuchurizhi();
- void xieruzhuangtai();
- void chongfa(CThostFtdcOrderField t);
- void closesell1(string sInvestorID, string sName, int sl, double jg);
- void closebuy1(string sInvestorID, string sName, int sl, double jg);
- void closesell2(string sInvestorID, string sName, int sl, double jg);
- void closebuy2(string sInvestorID, string sName, int sl, double jg);
- //委托与交易相关变量传递**************************************结束
- //
- //交易相关的变量设计结束
- //下面是我设计的公式模板调用变量名称,熟悉懂的可以修改,不懂的先研究,谨慎乱改
- private:
- //公式指标(function)变量设计(开始)******************************************
- double iff(bool cond1, int num, int ref);//iff函数
- double max2(double a, double b);//返回a,b中较大值
- double max3(double a, double b, double c);//返回a,b,c中最大值
- double min2(double a, double b); //返回a,b中较小值
- double min3(double a, double b, double c);//返回a,b,c中最小值
- double average(string period, string inst, int num); //均线函数变量
- double averageref(string period, string inst, int num, int ref); //均线average[1]功能函数变量
- double highest(string period, string inst, int num); //最高价highest函数变量
- double highestref(string period, string inst, int num, int ref);//最高high[1]功能函数变量
- double lowest(string period, string inst, int num); //最低价lowest函数变量
- double lowestref(string period, string inst, int num, int ref);//最低lowest[1] 功能函数变量
- double avgtruerange(string period, string inst, int num); //averagetruerange函数变量,atr计算功能
- double bollingerbands(string period, string inst, int num,int ref);//BOLL计算公式;
- double Variance(string period, string inst, int num);//方差计算公式变量
- double StandardDev(string period, string inst, int num);//标准差计算公式变量
- double xaverage(string period, string inst, int num);//xaverage计算公式;
- double ema(string period, string inst, int num);//ema计算公式;
- vector<double>emaarray(vector<double> pc, int num); //ema计算公式(返回数组);
- vector<double>averagearray(vector<double> pc, int num); //ema计算公式(返回数组);
- double closeref(string period, string inst, int ref);//获得close[ref]值
- double macd(string period, string inst, int num, int num1, int num2);//macd计算公式变量
- //公式指标(function)变量设计(结束)******************************************
- //下面是策略设计需要的一些变量与参数,设计策略时多会根据需要修改
- private:
- //公共变量设计(开始)*******************************
- int hd, yxpc, jg, fx, ss, tm, dbfx; //一些公共变量设置,hd:滑点,yxpc:优先平仓,jg:时间间隔,fx:方向,ss:手数,tm:时间,dbfx:单笔风险
- int num; //公式计算中周期的公共变量使用。
- int ref; //公式指标中[ref]回溯周期参数;
- vector<double>pc;//进行数组设计时统一的数组变量,方便以后使用中统一口径;
- //公共变量设计(结束)*******************************
- private:
- //软件界面策略参数设置相关的变量设计(开始)*******************************
- int length; //length:均线类的参数周期统一使用变量,方便后面使用中统一口径;
- int lots; //交易手数统一变量,方便在以后使用中统一口径
- int cscc; //初始持仓;
- //软件界面策略参数设置相关的变量设计(结束)*******************************
- };
复制代码 |
|