您需要 登录 才可以下载或查看,没有帐号?注册
我想用iCustom调用下面这个指标,当指标出现买的时候开买单,出现卖的时候开卖单,应该如何做呢?谢谢,
下面是指标源码:
div >
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Magenta
extern int RISK=4;
extern int AllBars=250;
int up=0,dn=0;
double val1buffer[];
double val2buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW,EMPTY);
SetIndexArrow(0,108);
SetIndexBuffer(0, val1buffer);
SetIndexStyle(1,DRAW_ARROW,EMPTY);
SetIndexArrow(1,108);
SetIndexBuffer(1, val2buffer);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
// int counted_bars=IndicatorCounted();
int start()
{
double value2;
double value3;
double value10=10;
double value11;
double x1=70;
double x2=30;
int TrueCount;
int counter;
int MRO1;
int MRO2;
int i1;
double Range;
double AvgRange;
double val1;
double val2;
double Table_value2[500][2];
int counted_bars=IndicatorCounted();
value10=3+RISK*2;
x1=67+RISK;
x2=33-RISK;
value11=value10;
//----------------------------
if(counted_bars0) counted_bars--; //last bar recounted
int i;
int shift = Bars-counted_bars-1;
if (shift AllBars) shift = AllBars;
for(i=shift; i i--)
{
counter=i;
Range=0;
AvgRange=0;
for (counter=i ;counter-1)
value11=3;
else
value11=value10;
if (MRO2 -1)
value11=4;
else
value11=value10;
value2=100-MathAbs(iWPR(NULL,0,value11,i));
Table_value2[i][0]=i;
Table_value2[i][1]=value2;
val1=0;
val2=0;
value3=0;
//------------------- val1
if (value2=x2 Table_value2[i+i1][1]x1)
{
value3=High[i]+Range*0.5;
val1=value3;
}
}
//------------------- val2
if ( value2 x1) // x1 = 70
{
i1=1;
while (Table_value2[i+i1][1] =x2 Table_value2[i+i1][1]
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!