你的问题较多,不知道从哪回答你。
新手先从简单的,正确的代码开始学习。
FYI.
//+------------------------------------------------------------------+ //| MA.mq4 | //| Copyright 2018, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2018, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 //--- plot MA #property indicator_label1 "MA" #property indicator_type1 DRAW_LINE #property indicator_color1 clrRed #property indicator_style1 STYLE_SOLID #property indicator_width1 1 input int MaPeriods = 60; input int MaMethod = MODE_SMA; input int MaPrice = PRICE_CLOSE; //--- indicator buffers double MABuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,MABuffer); SetIndexDrawBegin(0,MaPeriods); IndicatorDigits(_Digits); //--- 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,limit; if(rates_total<=0)return(0); if(prev_calculated<=0)limit=rates_total-1; else limit=rates_total-prev_calculated; for(i=limit;i>=0;i--) { MABuffer[i]=iMA(Symbol(),Period(),MaPeriods,0,MaMethod,MaPrice,i); } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
均线分好多种.每一种均线都有自己的特点.左边的行情永远是过去.不要想得到全部.行情出来后跟着就是最好的策略.可以用同花顺里边有几万个指标.有自动画线指标
感谢各位,我发现我的问题了
原来 用到「自订指标」的函数 是不能用在 「自动交易」里的
这两个用的函数是有一点分別的
Thx
Thx
我该怎么抓到全部柱数的iMA ??
其中 #property 这一段会照成 'xxxxx' is not expert and cannot be executed 的错误