您需要 登录 才可以下载或查看,没有帐号?注册
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 DodgerBlue
//---- input parameters
extern double target=2;
extern int AtrPeriod=20;
//---- buffers
double Up[],Dn[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
IndicatorBuffers(2);
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(0,Up);
SetIndexBuffer(1,Dn);
//---- name for DataWindow and indicator subwindow label
short_name= ATR( +AtrPeriod+ )
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
SetIndexLabel(1,short_name);
//----
SetIndexDrawBegin(0,AtrPeriod);
SetIndexDrawBegin(1,AtrPeriod);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Average True Range |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted();
//----
if(counted_bars 0) counted_bars--;
int limit=Bars-counted_bars;
for(i=0; i limit; i++)
{
Up[i]=Open[i]+target*iATR(NULL,0,AtrPeriod,i);
Dn[i]=Open[i]-target*iATR(NULL,0,AtrPeriod,i);
}
//----
return(0);
}
//+------------------------------------------------------------------+复制代码
指标, 止损, 动态
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!