软件名称:[B]金字塔布林通道+MA+diff落影模型源码[金字塔模型][/B]
软件类型:国产软件
运行环境:Win2000/WinXP/Win2003/WinVista
软件语言:简体中文
授权方式:共享软件
软件大小:0 Bytes
官方主页:Home Page
更新时间:2013-03-03 07:25:44
软件简介:
金字塔公式 金字塔模型策略源码:
input:P(26,20,100,8);
input:S(12,5,40,4);
input:B1(26,5,300,30);
input:B2(2,0.1,10,1);
input:N2(10,1,120,12);
input:N3(20,1,200,20);
input:N4(60,1,200,20);
ma2:=ma(c,n2);
ma3:=ma(c,n3);
ma4:=ma(c,n4);
MID := MA(CLOSE,B1);
UPPER:= MID + B2*STD(CLOSE,B1);
LOWER:= MID - B2*STD(CLOSE,B1),colorred;
diff := EMA(CLOSE,S) - EMA(CLOSE,P);
variable:vmin = 090000;//用于隔夜高开或低开时间差
if (abs(o-ref(c,1))>=20*MINDIFF AND time>090000 and time<090400) then vmin := 091500;
//开多仓条件:
BOPEON1:=c>upper and diff>0 and c>o and c>ma4 AND HOLDING=0 AND time>vmin AND time<144800;
//平多仓条件:
BLIQCON:=holding>0 and cross(ma3,ma2);
//开空仓条件:
SOPCON1:=c<lower and diff<0 and c<o and c<ma4 AND HOLDING=0 AND time>vmin AND time<144800;
//平空仓条件:
SLIQCON:=holding<0 and cross(ma2,ma3);
buy(BOPEON1,1,market);
sell(BLIQCON,holding,market);
buyshort(SOPCON1,1,market);
sellshort(SLIQCON,holding,market);
//收盘前平仓
sell(time>145400 and holding>0,holding,market);
sellshort(time>145400 and holding<0,holding,market);
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;
资产:ASSET,LINETHICK0;
==============================================================
源码解析:
MA2赋值:收盘价的N2日简单移动平均
MA3赋值:收盘价的N3日简单移动平均
MA4赋值:收盘价的N4日简单移动平均
赋值: 收盘价的B1日简单移动平均
UPPER赋值: MID + B2*收盘价的B1日估算标准差
LOWER赋值: MID - B2*收盘价的B1日估算标准差,画红色
赋值: 收盘价的S日指数移动平均 - 收盘价的P日指数移动平均
输出VARIABLE:VMIN = 090000
赋值: 091500
EON1赋值:收盘价>UPPER AND DIFF>0 AND 收阳线AND 收盘价>MA4 AND HOLDING=0 AND 时间>VMIN AND 时间<144800
QCON赋值:HOLDING>0 AND MA3上穿MA2
CON1赋值:收盘价<LOWER AND DIFF<0 AND 收阴线AND 收盘价<MA4 AND HOLDING=0 AND 时间>VMIN AND 时间<144800
QCON赋值:HOLDING<0 AND MA2上穿MA3
BUY(BOPEON1,1,MARKET)
SELL(BLIQCON,HOLDING,MARKET)
BUYSHORT(SOPCON1,1,MARKET)
SELLSHORT(SLIQCON,HOLDING,MARKET)
//收盘前平仓SELL(时间>145400 AND HOLDING>0,HOLDING,MARKET)
SELLSHORT(时间>145400 AND HOLDING<0,HOLDING,MARKET)
输出可用现金:CASH(0),线宽为0
输出持仓:HOLDING,线宽为0
输出资产:ASSET,线宽为0
[url=http://www.70822.com/soft/sort013/sort068/down-59327.html]金字塔布林通道+MA+diff落影模型源码[金字塔模型][/url]