FX.H
上传用户:bjghjy
上传日期:2007-01-07
资源大小:379k
文件大小:6k
- //////////////////////////////////////////////////////////////////////
- //This function and macro is to deal with the hirstory data analyser.
- //
- #define FRAME_WIDTH 2
- #define MAX_GPDM_SIZE 6
- #define MAX_PARA_NAME 6
- #define MIN_5 0
- #define MIN_15 1
- #define MIN_30 2
- #define MIN_60 3
- #define DAY 4
- #define WEEK 5
- #define MONTH 6
- #define DEFSHOWDOT 60
- #define MAXSHOWDOT 900
- #define ABS(x) ((x>=0) ? x:0.00-x)
- #define PV(x) ((x>=0) ? x:0.00)
- #define NV(x) ((x<=0) ? 0-x:0)
- #define FX_CLASS "JXFX"
- typedef struct tag_MACD_DATA
- {
- double macd;
- double ema1,ema2;
- double dif;
- double cha;
- }MACD_DATA, FAR *LPMACD_DATA;
- typedef struct tag_RSI_DATA
- {
- double un[3],dn[3],rsi[3];
- }RSI_DATA,FAR *LPRSI_DATA;
- typedef struct tag_DMI_DATA
- {
- double tr,pdm,ndm,pdi,ndi;
- double dx,adx;
- }DMI_DATA,LPDMI_DATA;
- typedef struct tag_PSY_DATA
- {
- double psy;
- }PSY_DATA,LPPSY_DATA;
- typedef struct tag_VR_DATA
- {
- double vr;
- }VR_DATA,LPVR_DATA;
- typedef struct tag_OBV_DATA
- {
- double obv;
- }OBV_DATA,LPOBV_DATA;
- typedef struct tag_BIAS_DATA
- {
- double bias;
- }BIAS_DATA,LPBIAS_DATA;
- typedef struct tag_WR_DATA
- {
- double wr[4];
- }WR_DATA,LPWR_DATA;
- typedef struct tag_KDJ_DATA
- {
- double k,d,j;
- }KDJ_DATA,LPKDJ_DATA;
- typedef struct tag_K_DATA
- {
- char date[10]; //yymmddhhmi
- float ks;
- float zg;
- float zd;
- float ss;
- long cj;
- }K_DATA,MAIN_DATA,FAR *LPK_DATA;
- //This struct to draw curve para.
- //feature:
- // bit1 -bit10 -----draw data object
- #define DW_DATA1 (1L<< 0)
- #define DW_FRAME (1L<<10)
- #define DW_LEFT (1L<<11)
- #define DW_X_COOR (1L<<12)
- #define DW_ALERT (1L<<13)
- #define DW_TOP (1L<<14)
- #define DW_NAME (1L<<15)
- #define DW_MAX (1L<<16)
- #define DW_MIN (1L<<17)
- #define DW_SELE (1L<<18)
- #define DW_NULL (1L<<19)
- #define DW_DELE (1L<<20)
- //bit 22 -25 is ret no code.value is 0 -16
- #define GetSerial(x) (x>>21)
- #define SetSerial(x,y) (x<<21|y)
- #define DW_BASE 0x3ff
- #define DW_OBJECT 0xffff
- #define DW_ATTR 0xffff0000
- #define DW_ALL 0x3fc00
- #define MAX_DATA_ITEM 10
- typedef struct tag_PARA
- {
- char name[MAX_PARA_NAME+1]; //参数名称
- char pname[MAX_DATA_ITEM][MAX_PARA_NAME+1]; //参数名称
- int no; //目标标号
- int dnum; //数据项个数
- COLORREF color[MAX_DATA_ITEM*2]; //色参数,对应于该目标的画图项数
- RECT rc; //作图区
- int pnum; //参数个数(指可调参数个数,等于Periods个数)
- int periods[MAX_DATA_ITEM]; //计算周期
- double price[5]; //价参数 price[0] MAX price[1] MIN price[2]alert1,price[3]alert2
- int htitle; //顶标注区高度
- int xtitle[5]; //顶标注区数据项X坐标(数据项名称在xtitle[i]-ltitle处)
- double fwdt,fhdj; //宽密度、高密度
- unsigned long feature; //32位特性码
- struct tag_PARA *next; //下一个参数对象指针
- }PARA;
- typedef struct tag_DATA
- {
- int no; //数据对象编号
- char gpdm[MAX_GPDM_SIZE+1]; //数据对象的股票代码
- int type; //数据对象的分析曲线类型
- int range; //分析周期
- int size; //每项数据个数
- int num; //数据项个数
- int method[MAX_DATA_ITEM]; //每个数据项的画法
- double* v[MAX_DATA_ITEM]; //数据值
- struct tag_DATA *next; //下一个数据对象地址
- }DATA;
- #define PRICE_BAR_METHOD 0 //用价参数画方形图(KS、SS、ZG、ZD)
- #define VOULMN_BAR_METHOD 1 //用量参数画方形图(CJ)
- #define CURVE_METHOD 2 //曲线
- #define VERT_LINE_METHOD 3 //垂直线
- typedef struct tag_PAINT_PARA
- {
- int num; //初始化表项数
- RECT rc; //作图区整体大小
- int wleft; //左标注区宽度
- int object; //操作目标的编号
- long item; //操作目标的项目编号
- BOOL IsMax; //窗口是否开大
- BOOL IsAvLineShow; //是否画平均线
- BOOL IsScroll; //窗口是否在左右滚动
- BOOL IsUpDown; //窗口是否在上下滚动
- BOOL IsPainting;
- BOOL IsSetPara; //是否在设置参数
- HFONT hFont;
- }PAINT_PARA;
- typedef struct tag_FX
- {
- char gpdm[MAX_GPDM_SIZE+1];
- char gpmc[20];
- PAINT_PARA PaintPara;
- MAIN_DATA *MainData;
- PARA KxPara,CjlPara;
- DATA KxData,CjlData;
- PARA *Para;
- DATA *Data;
- BOOL IsDataOk;
- int range,type;
- int ShowDot,RecCount,CurRecPrt,TotalCount;
- }FX,FAR *LPFX;
- HWND ghWndSetup;
- FX *Fx;
- char *RANGE_NAME[];
- unsigned int RANGE_MENU[7];
- BOOL RegisterFx();
- BOOL CreateWndFx(HWND);
- LRESULT CALLBACK FxWndProc(HWND, UINT, WPARAM, LPARAM);
- #define SCROLL_RIGHT 1
- #define SCROLL_LEFT -1
- #define SCROLL_CANCEL 0
- #define SCROLL_HOME 'H'
- #define SCROLL_END 'E'
- int DrawScroll(FX *fx,int orient);
- int UpDown(FX *fx,int orient);
- extern int vLineTo(HDC hDC, int x1, int y1);
- extern int hLineTo(HDC hDC, int x1, int y1);
- typedef struct tag_DAY_DATA
- {
- long day;
- float kpjg, spjg, zgjg, zdjg;
- long cjss;
- double cjje;
- }DAY_DATA, FAR *LPDAY_DATA;
- BOOL AnalyseInit(void);
- int WriteDefaultPara(void);
- int WritePara(PARA *para);
- int GetAnalysePara (PARA *para);
- void SetDiagColor(int x,int y,PARA *Para);
- void SetAnalysePara(PAINT_PARA *PaintPara);
- typedef int (* CREATEDATA)(K_DATA *MainData,int Num,DATA *Data,PARA *Para);
- typedef struct tag_ANALYSER_INIT_ITEM
- {
- int type;
- char name[MAX_PARA_NAME+1];
- CREATEDATA CreateData;
- }ANALYSER_INIT_TABLE;
- extern ANALYSER_INIT_TABLE *INIT_TABLE;
- extern HWND ghWndSetup;
- extern FX *Fx;
- extern BOOL RegisterFx(void);
- extern BOOL CreateWndFx(HWND hWnd);
- extern int FxExit(LPFX Fx);
- int DrawDiagram(HDC hDc,int CurRecPrt,int Show,PARA *Para,DATA *Data,PAINT_PARA *PaintPara,long feature);
- long GetObjectItem(int x,int y,int CurRecPrt,int Show,PARA *Para,DATA *Data,PAINT_PARA *PaintPara);