|
//------------------------------------------------------------------------
// 简称:MACDVOL
// 名称:MACD叠加VOL
// 类别: 交易指令
// 类型: 用户应用
//------------------------------------------------------------------------
Params
//参数定义
Integer LongPrd(26);
Integer ShortPrd(12);
Integer M(9);
Integer M1(5);
Integer M2(10);
Integer M3(20);
GlobalVars
//全局变量定义
Vars
//局部变量定义
Begin
//策略执行区
Numeric DIFF = EMA(Close,ShortPrd) - EMA(Close,LongPrd);
Numeric DEA = EMA(DIFF,M);
Numeric ret = 2*(DIFF-DEA);
PlotNumeric("DIFF",DIFF, DarkGreen);
PlotNumeric("DEA",DEA,DarkBrown);
SetOwnAxis("DIFF");
SetOwnAxis("DEA");
if(ret>0)
{
PlotBar("MACD",ret,0, True,ColorUp());
}
Else
{
PlotBar("MACD",ret,0, True,Green);
}
SetOwnAxis("MACD");
if(Close>Open)
PlotStickLine("VOL",Vol,0,Red);
Else
PlotStickLine("VOL",Vol,0,ColorDown());
//PlotNumeric("MA1",MA(Vol,M1));
//PlotNumeric("MA2",MA(Vol,M2));
//PlotNumeric("MA3",MA(Vol,M3));
PlotNumeric("持仓",OpenInt,0);
SetOwnAxis("持仓");
End |
|