LSMA

double 函数(int 均线周期, int 价格种类, int shift) //LSMA
{
   int j;
   double price;
   double n;
   double 单;
   int K = 均线周期;
   double sum = 0;
   for (int i = K; i >= 1; i--) 
   {
      n = K + 1;
      n /= 3.0;
      单 = 0;
      j = K - i + shift;
      switch (价格种类) 
      {
         case 0:
            price = Close[j];
            break;
         case 1:
            price = Open[j];
            break;
         case 2:
            price = High[j];
            break;
         case 3:
            price = Low[j];
            break;
         case 4:
            price = (High[j] + Low[j]) / 2.0;
            break;
         case 5:
            price = (High[j] + Low[j] + Close[j]) / 3.0;
            break;
         case 6:
            price = (High[j] + Low[j] + 2.0 * Close[j]) / 4.0;
      }
      单 = (i - n) * price;
      sum += 单;
   }
   double ans = MathFloor(6.0 * sum / (K * (K + 1)) / Point) * Point;
   return (ans);
}
本博客所有文章如无特别注明均为原创。作者:天泓评测
分享到:更多

相关推荐

发表评论

路人甲 表情
Ctrl+Enter快速提交

网友评论(0)