外汇论坛 外兔财经

开启左侧

请教高手

[复制链接]
发表于 2006-8-24 15:56 | 显示全部楼层 |阅读模式
https://www.y2cn.com
这是MT4.0里的编程,怎么能把它变成三根线,不知道这个编程对不对呀,,





//+------------------------------------------------------------------+
//|                                                         BIAS.mq4 |
//|                       Copyright ?2005, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Silver

//---- input parameters
extern int       MAPeriod=9;



//---- buffers
double ind_buffer[];
double BiasBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(2);
   SetIndexBuffer(0, BiasBuffer);
   SetIndexBuffer(1, ind_buffer);
     
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,BiasBuffer);
   
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("BIAS("+MAPeriod+")");
   SetIndexLabel(0,"BIAS");
      
//----
   SetIndexDrawBegin(0,MAPeriod);
   return(0);
//----
   }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int i;
   
//----
   if(Bars<=MAPeriod) return(0);
   
//---- initial zero
   if(counted_bars<1)
      for(i=1;i<=MAPeriod;i++) BiasBuffer[Bars-i]=0.0;
//----
   i=Bars-MAPeriod-1;
   if(counted_bars>=MAPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {ind_buffer=iMA(NULL,0,MAPeriod,0,MODE_SMA,PRICE_CLOSE,i);
      BiasBuffer=(Close-ind_buffer)/ind_buffer;
      i--;
     }
         
//----
   return(0);
  }
  
//+------------------------------------------------------------------+

本版积分规则

QQ|手机版 Mobile Version|Archiver|关于我们 About Us|联系我们 Contact Us|Y2外汇论坛 外兔财经

GMT+8, 2024-5-17 15:37 , Processed in 0.039746 second(s), 23 queries .

Powered by Discuz! X7.2

Copyright © 2001-2021, Tencent Cloud.

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