williamkkung 发表于 2013-1-12 12:32:57

求助牛版一个小指标的调整

本帖最后由 williamkkung 于 2013-1-20 03:00 编辑

一直在MT4中使用的一个小指标,现在想在Mt5中使用,调整代码的时候遇到问题,没有什么基础,试了好久还是没有改好,先将代码贴出来希望高人牛版能帮忙调整一下,非常感谢!!
Mt4代码
property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
extern color LineColor = Chartreuse;
extern int LineWidth = 1;
extern int LineStyle = 2;
int init()
{
//---- indicators
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                     |
//+------------------------------------------------------------------+
int deinit()
{
//----
   
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int    counted_bars=IndicatorCounted();
//----
   if (ObjectFind("AutoLine")!=-1)
      ObjectDelete("AutoLine");
   
   ObjectCreate("AutoLine", OBJ_VLINE, 0, Time, 0);   
   ObjectSet("AutoLine", OBJPROP_COLOR, LineColor);
   ObjectSet("AutoLine", OBJPROP_WIDTH, LineWidth);
   ObjectSet("AutoLine", OBJPROP_STYLE, LineStyle);
//----
   return(0);
}
//+------------------------------------------------------------------+

Mt5代码,我自己修改的,但是还用不了,有错误
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
#property indicator_type1   DRAW_LINE
#property indicator_color1Black
#property indicator_style10
#property indicator_width10
#property indicator_label1"AutoMove"

//---- indicator buffers
double               ExtLineBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
   
//---
   return(0);
}
//+------------------------------------------------------------------+
//| 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 OnCalculate_bars=OnCalculate();
//---
   if (ObjectFind(0,"AutoLine")!=-1)
      ObjectDelete(0,"AutoLine");
//--- return value of prev_calculated for next call
   return(rates_total);
}
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
   
}
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
{
//---
   
}
//+------------------------------------------------------------------+

williamkkung 发表于 2013-1-12 21:08:10

自己先顶一小下

gbz 发表于 2013-1-13 03:55:06

怎么调的呀

williamkkung 发表于 2013-1-17 00:50:02

人气太弱啊,没人来帮帮看看,谢谢啦!!

williamkkung 发表于 2013-1-20 02:59:49

还是得等牛版前来帮助啊!!求助!!

zhou1388 发表于 2013-1-29 01:16:06

帮你顶~~~

lizhixing 发表于 2013-1-29 01:47:39

{:soso_e200:}

williamkkung 发表于 2013-2-28 02:00:14

那位高人能来给帮忙看看吧 谢谢啦
页: [1]
查看完整版本: 求助牛版一个小指标的调整