海龟交易源码
//+------------------------------------------------------------------+//| MrBean.mq4 |
//| Copyright ?2004, Fourway Software Corp. |
//| http://www.fourway.com |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2004, Fourway Software Corp."
#property link "http://www.fourway.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DarkSalmon
#property indicator_color2 CornflowerBlue
//---- input parameters
extern int ExtParam1=21;
extern int ExtParam2=21;
extern int PriceMode=1;
extern int ATR_Period = 13;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ATR = iATR(NULL, 0, ATR_Period, 0);
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexDrawBegin(1,ExtParam1);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexDrawBegin(1,ExtParam2);
SetIndexBuffer(1,ExtMapBuffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//----
for(int i=0; i<limit; i++)
//ExtMapBuffer1=iMA(NULL,0,ExtParam1,MODE_EMA,0,PRICE_CLOSE,i);
{
if(PriceMode == 0) ExtMapBuffer1=Close;
if(PriceMode == 1) ExtMapBuffer1=Low;
}
//----
for(i=0; i<limit; i++)
{
if(PriceMode == 0) ExtMapBuffer2=Close;
if(PriceMode == 1) ExtMapBuffer2=High;
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
谢谢楼主分享 帮你顶下哈!! 支持下 {:1_179:} {:1_179:} 顶下 支持下 支持下 支持下