vama.afl

来自「一个更精度的平滑涵数, 可用于股票交易系统.用于Amibroker 平台」· AFL 代码 · 共 56 行

AFL
56
字号
//------------------------------------------------------------------------------
//
//  Formula Name:    VAMA
//  Author/Uploader: kysiek 
//  E-mail:          
//  Date/Time Added: 2006-07-05 12:20:34
//  Origin:          
//  Keywords:        
//  Level:           basic
//  Flags:           indicator
//  Formula URL:     http://www.amibroker.com/library/formula.php?id=632
//  Details URL:     http://www.amibroker.com/library/detail.php?id=632
//
//------------------------------------------------------------------------------
//
//  Volume Adjusted Moving Average
//
//------------------------------------------------------------------------------

Period=Param("Period",50,1,100);
agg=0;
for (i=0;i<BarCount;i++)
{
Vama[i]=0;
}
for (i=1;i<BarCount;i++)
{
agg=agg+Volume[i];
}
ave=agg/(BarCount-1);


for (i=1;i<BarCount;i++)
{
weight_day[i]=int((Volume[i]/ave)-0.5)+1;
}
agg=0;
for (i=1;i<BarCount;i++)
{
index=i;
Copy_wd=weight_day;
 for (j=0;j<Period;j++)
     {
      if(Copy_wd[index]==0) {index--;};
      agg=agg+C[Index];
      Copy_wd[index]--;
     }
Vama[i]=agg/Period;
agg=0;
}
Plot(Vama,"Vama",ParamColor( "Vama", colorRed),1);
Plot(C,"Price",ParamColor( "Price",colorBlack),1);
Plot(MA(C,Period),"Ma",colorBlue,1);
Short=Cover=0;
Buy=Cross(C,Vama);
Sell=Cross(Vama,C);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?