求助!自己编写的mt5波幅指标,总是显示在副图上,无法显示在主图。求助大神帮忙看下怎么回事,跪谢! 新评论 yang zhang 2024.04.09 15:45 //+------------------------------------------------------------------+ //| WaveRange.mq5| //| Copyright 2024, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "2024, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #property indicator_separate_window false // 将指标显示在主图表上 #property indicator_buffers 1 #property indicator_plots 1 input ENUM_TIMEFRAMES Period = PERIOD_M30; // 时间周期 // 输入参数 input color WaveColor = clrBlue; // 波幅线颜色 input int WaveWidth = 1; // 波幅线宽度 // 缓冲区 double WaveBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { // 设置指标线属性 SetIndexBuffer(0, WaveBuffer); PlotIndexSetInteger(0, PLOT_DRAW_TYPE, DRAW_LINE); PlotIndexSetInteger(0, PLOT_LINE_COLOR, WaveColor); PlotIndexSetInteger(0, PLOT_LINE_WIDTH, WaveWidth); // 设置指标显示在主图表上 ChartSetInteger(0, CHART_FOREGROUND,true); // 显示在前景 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 - 1; if (prev_calculated > 0) limit = prev_calculated - 1; for (int i = limit; i >= 0; i--) { // 计算波幅 double range = MathAbs(open[i] - close[i]); // 将波幅保存到缓冲区中 WaveBuffer[i] = range; } return(rates_total); } yang zhang 2024.04.09 15:47 #1 如图 附加的文件: uto.png 39 kb Hung Wen Lin 2024.04.10 04:13 #2 #property indicator_chart_window #property indicator_separate_window false 兩個指令換一下 你這個計算數值很小 放在主圖上看不到啥東西的 yang zhang 2024.04.21 14:27 #3 Hung Wen Lin #: 兩個指令換一下 你這個計算數值很小 放在主圖上看不到啥東西的 谢谢 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录