找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
首页论坛EAHub 外汇论坛
查看: 7|回复: 0

均线金叉死叉,箭头不对

[复制链接]

4万

主题

54

回帖

4万

积分

管理员

积分
45954
发表于 2026-8-19 21:51:00 | 显示全部楼层 |阅读模式
最后由 akkk333 于 2020-6-21 09:48 编辑

#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots   4
//--- plot da
//--- plot xiao
#property indicator_label2  "xiao"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrYellow
#property indicator_style2  STYLE_SOLID
#property indicator_width2  1
//--- plot up
#property indicator_label3  "up"
#property indicator_type3   DRAW_ARROW
#property indicator_color3  clrWhite
#property indicator_style3  STYLE_SOLID
#property indicator_width3  1
//--- plot down
#property indicator_label4  "down"
#property indicator_type4   DRAW_ARROW
#property indicator_color4  clrAqua
#property indicator_style4  STYLE_SOLID
#property indicator_width4  1
//--- input parameters
input int      大周期=10;
input int      小周期=30;
//--- indicator buffers
double         daBuffer[];
double         xiaoBuffer[];
double         upBuffer[];
double         downBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,daBuffer);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,clrRed);
   SetIndexLabel(0,"da");
   SetIndexBuffer(1,xiaoBuffer);
   SetIndexBuffer(2,upBuffer);
   SetIndexBuffer(3,downBuffer);
   SetIndexArrow(2,225);
   SetIndexArrow(3,226);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
  int i=0;  
  for (i=0;i<600;i++)
  {
    daBuffer= iMA(NULL,0,大周期,0,MODE_SMA,PRICE_CLOSE,i);
    xiaoBuffer= iMA(NULL,0,小周期,0,MODE_SMA,PRICE_CLOSE,i);
   }
  for (i=0;i<600;i++)
     {
     if (xiaoBuffer>daBuffer &&  xiaoBuffer[i+1]<daBuffer[i+1]);
     {
     upBuffer=daBuffer;
     }
     if (xiaoBuffer<daBuffer &&  xiaoBuffer[i+1]>daBuffer[i+1]);
     {
     downBuffer=xiaoBuffer;
     }
   }
//--- return value of prev_calculated for next call
   return(rates_total);
  }

复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|EAHub外汇论坛

GMT+8, 2026-10-10 15:04 , Processed in 0.106197 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表