问吧! - 页 151

 

MetaTrader和订单簿

好吧,我必须说 "Ask "和 "Bid "的预定义变量实际上储存了最好的订单。但是订单簿的其他级别和手数呢?我可以在我的代码中使用这些数据吗?

请帮助我,我在网上搜索了很多地方,但没有找到答案。

尊敬的先生

 

一个快速的问题...

老兄,如果我做了黑体字,那么我就不需要做下划线,对吗?

if(Ask>=Line1)

{

posisi=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slipage,0,0, "OneLineEA ver 1.0",Megic,0,Green)。

如果(OrderSelect(posisi,SELECT_BY_TICKET)==true)

{

posisi=OrderTicket()。

}

}

 

请帮助我

嗨,代码大师(codersguru)。

非常感谢您

请你解释一下这个语句和它的含义

for(int shift = Bars-10; shift >= 0; shift-)

{

ExtMapBuffer1[shift] = ma[shift];

ExtMapBuffer2[shift] = ma[shift];

//打印(ma[shift])。

如果(ma[shift] > ma[shift+1])

{

ExtMapBuffer1[shift] = EMPTY_VALUE;

ExtMapBuffer2[shift+1] = ma[shift+1];

}

否则如果(ma[shift] < ma[shift+1])

{

ExtMapBuffer2[shift] = EMPTY_VALUE。

ExtMapBuffer1[shift+1] = ma[shift+1];

}

在本EA中

//---- 指标设置

#属性 indicator_chart_window

#属性 indicator_buffers 2

#属性 indicator_color1 Lime

#属性 indicator_color2 Red

//---- 缓冲区

double ExtMapBuffer1[]。

double ExtMapBuffer2[],ma[];

extern int MAType = 1;

extern int MAPeriod = 34;

extern int MAShift = 0;

extern int PriceType=0;

//+------------------------------------------------------------------+

//|自定义指标 初始化函数

//+------------------------------------------------------------------+

int init()

{

//---- 2个额外的缓冲区被用于计数。

IndicatorBuffers(5)。

//---- 绘图设置

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexBuffer(2,ma);

SetIndexStyle(0,DRAW_LINE,0,2);

SetIndexStyle(1,DRAW_LINE,0,2);

//---- 初始化完成

返回(0)。

}

int start()

{

for(int i = Bars-10; i >= 0; i--)

{

ma=iMA(NULL,0,MAPeriod,MAShift,MAType,PriceType,i)。

}

for(int shift = Bars-10; shift >= 0; shift--)

{

ExtMapBuffer1[shift] = ma[shift];

ExtMapBuffer2[shift] = ma[shift];

//打印(ma[shift])。

如果(ma[shift] > ma[shift+1])

{

ExtMapBuffer1[shift] = EMPTY_VALUE;

ExtMapBuffer2[shift+1] = ma[shift+1];

}

否则如果(ma[shift] < ma[shift+1])

{

ExtMapBuffer2[shift] = EMPTY_VALUE。

ExtMapBuffer1[shift+1] = ma[shift+1];

}

}

return(0);

}

//+------------------------------------------------------------------+

谢谢你

 

这不是EA,而是指标,当"移动 平均线 "指标上升或下降时,它会向你显示。

你需要的那段代码只计算最后十条。

把它放在/indicators目录下,然后重新启动你的终端。

 

不同的是

大家好

可以帮助我

EMA5c和EMA5p有什么不同?

什么意思(EMA5c>EMA10c && EMA5pEMA10c))

double EMA5c = iMA(NULL,TimeFrame,5,0,MODE_EMA,PRICE_CLOSE, 0);

double EMA10c = iMA(NULL,TimeFrame,10,0,MODE_EMA,PRICE_CLOSE,0);

double EMA5p = iMA(NULL,TimeFrame,5,0,MODE_EMA,PRICE_CLOSE, 1);

double EMA10p = iMA(NULL,TimeFrame,10,0,MODE_EMA,PRICE_CLOSE,1);

 

这些名字只是变量名,并没有任何意义。程序员通常会选择变量名称,以便不言自明地说明它们应该持有什么样的值。看一下这两个变量,似乎程序员选择了在当前的bar变量上添加后缀c,在之前的bar变量上添加p。

拉克斯

 

我有一个问题,我有一个朋友给我的指标,我已经演示了几个星期了,很喜欢它。 简短的解释是,一个箭头会出现在我的图表上,告诉我以何种方式进行运动。 我在30米的图表上使用它,所以它并不经常出现。 有没有办法使它在箭头显示多头头寸时,将关闭我的空头头寸并做多,或者如果没有空头头寸就做多。 反之亦然,空头信号也是如此?

 

我没有看到一个编辑按钮,所以这里是代码。 只要加入买入或卖出的代码,似乎并不困难。 这是 "之 "字形代码中的内容。 免费的ind。

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 Red

//---- indicator parameters

extern int ExtDepth=12;

extern int ExtDeviation=5;

extern int ExtBackstep=3;

//---- indicator buffers

double ZigzagBuffer[];

double HighMapBuffer[];

double LowMapBuffer[];

int level=3; // recounting's depth

bool downloadhistory=false;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

IndicatorBuffers(3);

//---- drawing settings

SetIndexStyle(0,DRAW_SECTION);

//---- indicator buffers mapping

SetIndexBuffer(0,ZigzagBuffer);

SetIndexBuffer(1,HighMapBuffer);

SetIndexBuffer(2,LowMapBuffer);

SetIndexEmptyValue(0,0.0);

//---- indicator short name

IndicatorShortName("ZigZag("+ExtDepth+","+ExtDeviation+","+ExtBackstep+")");

//---- initialization done

return(0);

}

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

int start()

{

int i, counted_bars = IndicatorCounted();

int limit,counterZ,whatlookfor;

int shift,back,lasthighpos,lastlowpos;

double val,res;

double curlow,curhigh,lasthigh,lastlow;

if (counted_bars==0 && downloadhistory) // history was downloaded

{

ArrayInitialize(ZigzagBuffer,0.0);

ArrayInitialize(HighMapBuffer,0.0);

ArrayInitialize(LowMapBuffer,0.0);

}

if (counted_bars==0)

{

limit=Bars-ExtDepth;

downloadhistory=true;

}

if (counted_bars>0)

{

while (counterZ<level && i<100)

{

res=ZigzagBuffer;

if (res!=0) counterZ++;

i++;

}

i--;

limit=i;

if (LowMapBuffer!=0)

{

curlow=LowMapBuffer;

whatlookfor=1;

}

else

{

curhigh=HighMapBuffer;

whatlookfor=-1;

}

for (i=limit-1;i>=0;i--)

{

ZigzagBuffer=0.0;

LowMapBuffer=0.0;

HighMapBuffer=0.0;

}

}

for(shift=limit; shift>=0; shift--)

{

val=Low;

if(val==lastlow) val=0.0;

else

{

lastlow=val;

if((Low[shift]-val)>(ExtDeviation*Point)) val=0.0;

else

{

for(back=1; back<=ExtBackstep; back++)

{

res=LowMapBuffer[shift+back];

if((res!=0)&&(res>val)) LowMapBuffer[shift+back]=0.0;

}

}

}

if (Low[shift]==val) LowMapBuffer[shift]=val; else LowMapBuffer[shift]=0.0;

//--- high

val=High;

if(val==lasthigh) val=0.0;

else

{

lasthigh=val;

if((val-High[shift])>(ExtDeviation*Point)) val=0.0;

else

{

for(back=1; back<=ExtBackstep; back++)

{

res=HighMapBuffer[shift+back];

if((res!=0)&&(res<val)) HighMapBuffer[shift+back]=0.0;

}

}

}

if (High[shift]==val) HighMapBuffer[shift]=val; else HighMapBuffer[shift]=0.0;

}

// final cutting

if (whatlookfor==0)

{

lastlow=0;

lasthigh=0;

}

else

{

lastlow=curlow;

lasthigh=curhigh;

}

for (shift=limit;shift>=0;shift--)

{

res=0.0;

switch(whatlookfor)

{

case 0: // look for peak or lawn

if (lastlow==0 && lasthigh==0)

{

if (HighMapBuffer[shift]!=0)

{

lasthigh=High[shift];

lasthighpos=shift;

whatlookfor=-1;

ZigzagBuffer[shift]=lasthigh;

res=1;

}

if (LowMapBuffer[shift]!=0)

{

lastlow=Low[shift];

lastlowpos=shift;

whatlookfor=1;

ZigzagBuffer[shift]=lastlow;

res=1;

}

}

break;

case 1: // look for peak

if (LowMapBuffer[shift]!=0.0 && LowMapBuffer[shift]<lastlow && HighMapBuffer[shift]==0.0)

{

ZigzagBuffer[lastlowpos]=0.0;

lastlowpos=shift;

lastlow=LowMapBuffer[shift];

ZigzagBuffer[shift]=lastlow;

res=1;

}

if (HighMapBuffer[shift]!=0.0 && LowMapBuffer[shift]==0.0)

{

lasthigh=HighMapBuffer[shift];

lasthighpos=shift;

ZigzagBuffer[shift]=lasthigh;

whatlookfor=-1;

res=1;

}

break;

case -1: // look for lawn

if (HighMapBuffer[shift]!=0.0 && HighMapBuffer[shift]>lasthigh && LowMapBuffer[shift]==0.0)

{

ZigzagBuffer[lasthighpos]=0.0;

lasthighpos=shift;

lasthigh=HighMapBuffer[shift];

ZigzagBuffer[shift]=lasthigh;

}

if (LowMapBuffer[shift]!=0.0 && HighMapBuffer[shift]==0.0)

{

lastlow=LowMapBuffer[shift];

lastlowpos=shift;

ZigzagBuffer[shift]=lastlow;

whatlookfor=1;

}

break;

default: return;

}

}

return(0);

}

//+------------------------------------------------------------------+
 

新手问题

大家好

是否可以在前一根蜡烛上寻找一个自定义指标? 如果可以,我应该怎么做?

基本上我想寻找指标的颜色。

谢谢你

 
basalo:
大家好

是否可以在前一根蜡烛上寻找一个自定义指标? 如果可以,我应该怎么做?

基本上我想寻找指标的颜色。

谢谢你的帮助

在元编辑器帮助文件中查看iCustom函数

拉克斯

原因: