zhonghe520 2019-06-14 23:12
浏览 571

哪位指标大哥空闲帮我写一个指标___通达信的源码改成MT4的

图片说明

M:1,11111,12:
N:2,3,2:
D:2,3,3:

MA9 : MA(CLOSE,M*(9/12)*(N/2)*(D/3)),COLORRED,LINETHICK2;

MA12 : MA(CLOSE,M*(N/2)*(D/3)),COLORYELLOW,LINETHICK2;

MA18 : MA(CLOSE,M*2*(9/12)*(N/2)*(D/3)),COLORRED,LINETHICK2;

MA27 : MA(CLOSE,M*(27/12)*(N/2)*(D/3)),COLORGREEN,LINETHICK2;

UP: MA27 + 1*STD(CLOSE,M*(27/12)*(N/2)*(D/3)),COLORGREEN,DOTLINE;
LO: MA27 - 1*STD(CLOSE,M*(27/12)*(N/2)*(D/3)),COLORGREEN,DOTLINE;

UP1: MA27 + 2*STD(CLOSE,M*(27/12)*(N/2)*(D/3)),COLORRED,DOTLINE;
LO1: MA27 - 2*STD(CLOSE,M*(27/12)*(N/2)*(D/3)),COLORRED,DOTLINE;

下面是MT4的均线代码 ——只需要在这个基础上把布林加上就可以了,老师!非常感谢您!
//+------------------------------------------------------------------+
//| 三色均线指标.mq4 |
//| Copyright 2019, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_plots 3
//--- plot MA1
#property indicator_label1 "MA9"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrRed
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//--- plot MA2
#property indicator_label2 "MA12"
#property indicator_type2 DRAW_LINE
#property indicator_color2 clrYellow
#property indicator_style2 STYLE_SOLID
#property indicator_width2 1
//--- plot MA3
#property indicator_label3 "MA26"
#property indicator_type3 DRAW_LINE
#property indicator_color3 clrGreen
#property indicator_style3 STYLE_SOLID
#property indicator_width3 1
//--- indicator buffers
double MA1Buffer[];
double MA2Buffer[];
double MA3Buffer[];

input int M=12;//
input int N=2;//
input int D=3;//

input int shift=0;//平移
input ENUM_MA_METHOD method=MODE_SMA;//类型
input ENUM_APPLIED_PRICE price=PRICE_CLOSE;//应用于

int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,MA1Buffer);
SetIndexBuffer(1,MA2Buffer);
SetIndexBuffer(2,MA3Buffer);

//---
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 shu=0;
  if(prev_calculated==0)
    {
        shu=rates_total;
    }
  else
    {
        shu=rates_total-prev_calculated+1;
    }

  for(int i=0;i<shu;i++)
    {
        MA1Buffer[i]=iMA(Symbol(),0,(int)(M*(9.0/12.0)*(N/2.0)*(D/3.0)),shift,method,price,i);
        MA2Buffer[i]=iMA(Symbol(),0,(int)(M*(N/2.0)*(D/3.0)),shift,method,price,i);
        MA3Buffer[i]=iMA(Symbol(),0,(int)(M*(26.0/12.0)*(N/2.0)*(D/3.0)),shift,method,price,i);
    }     

//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
    • ¥30 python代码,帮调试
    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿