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

如何在Lab3Buffer[i] 这的点,画一条线

[复制链接]

4万

主题

54

回帖

4万

积分

管理员

积分
45954
发表于 2026-8-21 12:30:00 | 显示全部楼层 |阅读模式
//+------------------------------------------------------------------+

//|                                                         第三指标.mq4 |

//|                        Copyright 2022, MetaQuotes Software Corp. |

//|                                             https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright "Copyright 2022, MetaQuotes Software Corp."

#property link      "https://www.mql5.com"

#property version   "1.00"

#property strict

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_plots   4

//--- plot Lab1

#property indicator_label1  "Lab1"

#property indicator_type1   DRAW_LINE

#property indicator_color1  clrDarkGreen

#property indicator_style1  STYLE_SOLID

#property indicator_width1  1

//--- plot Lab2

#property indicator_label2  "Lab2"

#property indicator_type2   DRAW_LINE

#property indicator_color2  clrRed

#property indicator_style2  STYLE_SOLID

#property indicator_width2  1

//--- plot Lab3

#property indicator_label3  "Lab3"

#property indicator_type3   DRAW_LINE

#property indicator_color3  clrBlack

#property indicator_style3  STYLE_SOLID

#property indicator_width3  1

//--- plot Lab4

#property indicator_label4  "Lab4"

#property indicator_type4   DRAW_LINE

#property indicator_color4  clrBlack

#property indicator_style4  STYLE_SOLID

#property indicator_width4  1

//--- indicator buffers

double         Lab1Buffer[];

double         Lab2Buffer[];

double         Lab3Buffer[];

double         Lab4Buffer[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function                         |

//+------------------------------------------------------------------+

int OnInit()

  {

//--- indicator buffers mapping

   SetIndexBuffer(0,Lab1Buffer);

   SetIndexBuffer(1,Lab2Buffer);

   SetIndexBuffer(2,Lab3Buffer);

   SetIndexBuffer(3,Lab4Buffer);


//---

   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 limit = rates_total - prev_calculated;

      if(limit == 0) limit++;

      for(int i = 0; i < limit; i++) {

         Lab1Buffer = iIchimoku(NULL,0,9,1,52,MODE_SENKOUSPANA,i);

         Lab2Buffer =iIchimoku(NULL,0,9,1,52,MODE_SENKOUSPANB,i);

      }

       for(int i = 0; i < limit; i++) {

         if(Lab1Buffer >= Lab2Buffer && Lab1Buffer[i+1]<Lab2Buffer[i+1]) {

            Lab3Buffer =Lab2Buffer;


         }


         else if(Lab1Buffer<=Lab2Buffer && Lab1Buffer[i+1]>Lab2Buffer[i+1]) {

             Lab3Buffer = Lab2Buffer;

             Lab4Buffer=Lab3Buffer;

      }

      }


   return(rates_total);

  }
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-10-11 04:57 , Processed in 0.101338 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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