自己写的指标 在趋势中动态止损
#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=Open+target*iATR(NULL,0,AtrPeriod,i);
Dn=Open-target*iATR(NULL,0,AtrPeriod,i);
}
//----
return(0);
}
//+------------------------------------------------------------------+ 不会用 感谢分享。。。。。 学习学习学习学习学习学习学习学习 感谢分享,不过不会用啊 能否教一下怎么用 dddddddddddddddddddddddddddddddddddd 怎么个东西? 不能下单。搞毛啊。 这是指标,当然不会下单了
页:
[1]