如何编码? - 页 329

 

我怎样才能观看实时的年度蜡烛

我做了年度蜡烛,但它们是脱机工作的,有什么办法让它们活起来吗?

 
kfma8899:
我做了年度蜡烛图,但它们在离线状态下工作,有什么办法能让它们实时工作吗?

不,你不能。任何离线图表都不能作为实时图表使用(你能做的就是通过向已打开的离线图表发送事件来模拟它,即一个新的tick已经产生/到达,它看起来像一个实时图表,但它仍然是一个离线图表)。

 

如何增加年度蜡烛的数量,我只得到了8根蜡烛

如何增加年度蜡烛的数量 我只得到了8根蜡烛

 
kfma8899:
如何增加年度蜡烛的数量,我只得到8根蜡烛

下载更多用于生成年度离线图表的数据

 

你好,Mrtools

请帮助我为这个指标自动设置时间框架

support_and_resistance__mtfalerts.mq4

当我在M1图表上添加指标时,指标的时间框架是15

当我从M1到M15的时间框架,指标将自动设置时间框架=60

当我从M15到M30的时间框架时,指标将自动设置时间框架=240

....

m1:时间框架 = 15

m5:时间框架=30

m15:时间框架=60

m30:时间框架=240

H1:时间框架=240

h4:时间框架=1440

D1:时间框架=10080

谢谢你!

附加的文件:
 

我想让它在对某一货币对发出 "买入 "信号时,不会再对该货币对发出 "买入 "信号,直到它发出 "卖出 "信号。

#我希望当它在一个货币对上发出 "买 "的信号时,它不会再在该货币对上发出 "买 "的信号,直到它发出 "卖 "的信号。

#属性 Indicator_buffers 2

#属性 Indicator_color1 Lime

#属性 Indicator_color2 Red

//--- 缓冲区

double ExtMapBuffer1[];

double ExtMapBuffer2[];

//外部变量......

extern int barsToProcess=100;

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

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

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

int init()

{

//---- 指标

SetIndexStyle(0,DRAW_ARROW);

SetIndexArrow(0,217);

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexEmptyValue(0,0.0);

SetIndexStyle(1,DRAW_ARROW)。

SetIndexArrow(1,217);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexEmptyValue(1,0.0)。

//----

返回(0)。

}

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

//|自定义指标去初始化功能|

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

int deinit()

{

//----

//----

return(0);

}

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

//|自定义指标迭代函数|

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

int start()

{

int counted_bars=IndicatorCounted(),

限度。

如果(counted_bars>0)

counted_bars--。

limit=Bars-counted_bars。

如果(limit>barsToProcess)

limit=barsToProcess。

for(int i=0;i<limit;i++)

{

double ema13=iMA(NULL,0,13,0,MODE_EMA,PRICE_CLOSE,0)。

double ema5=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,0)。

double b4ema13=iMA(NULL,0,13,0,MODE_EMA,PRICE_CLOSE,1);

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

double mom=iMomentum(NULL,0,14,PRICE_CLOSE,0);

double b4mom=iMomentum(NULL,0,14,PRICE_CLOSE,1);

}

static datetime lastAlerted=0;

静态字符串AlertType1=""。

静态字符串AlertType2=""。

//提高警报

if((ema5>ema13)&&(ema5>b4ema5)&&(ema13>b4ema13)&&(mom>b4mom)&&(mom>98.6591)&&(lastAlerted!=Time[0])&&(AlertType1!="Buy")){

ExtMapBuffer1=High+5*Point。

}否则

ExtMapBuffer1=0.0。

Alert(Symbol()," ",Period(), "M Price UP")。

//卖出警报

if((ema5<ema13)&&(ema5<b4ema5)&&(ema13<b4ema13)&&(mom<b4mom)&&(mom<100.6872)&&(lastAlerted!=Time[0])&&(AlertType2!="Sell")){

ExtMapBuffer2=Low-5*Point。

}否则

ExtMapBuffer2=0.0。

Alert(Symbol()," ",Period(), "M价格下跌")。

返回(0)。

}

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

 
Mastercash:
谁能帮我看看这段代码......它总是重复相同的警报,例如,如果它在一个货币对上发出买入警报,在大约7个蜡烛之后,它将在同一货币对上发出相同的买入警报。

#属性 indicator_chart_window

#属性 indicator_buffers 2

#属性 indicator_color1 Lime

#属性 indicator_color2 Red

//--- 缓冲区

double ExtMapBuffer1[];

double ExtMapBuffer2[];

//外部变量......

extern int barsToProcess=100;

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

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

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

int init()

{

//---- 指标

SetIndexStyle(0,DRAW_ARROW);

SetIndexArrow(0,217);

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexEmptyValue(0,0.0);

SetIndexStyle(1,DRAW_ARROW)。

SetIndexArrow(1,217);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexEmptyValue(1,0.0)。

//----

返回(0)。

}

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

//|自定义指标去初始化功能|

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

int deinit()

{

//----

//----

return(0);

}

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

//|自定义指标迭代函数|

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

int start()

{

int counted_bars=IndicatorCounted(),

限度。

如果(counted_bars>0)

counted_bars--。

limit=Bars-counted_bars。

如果(limit>barsToProcess)

limit=barsToProcess。

for(int i=0;i<limit;i++)

{

double ema13=iMA(NULL,0,13,0,MODE_EMA,PRICE_CLOSE,0)。

double ema5=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,0)。

double b4ema13=iMA(NULL,0,13,0,MODE_EMA,PRICE_CLOSE,1);

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

double mom=iMomentum(NULL,0,14,PRICE_CLOSE,0);

double b4mom=iMomentum(NULL,0,14,PRICE_CLOSE,1)。

}

static datetime lastAlerted=0;

静态字符串AlertType1=""。

静态字符串AlertType2=""。

//提高警报

if((ema5>ema13)&&(ema5>b4ema5)&&(ema13>b4ema13)&&(mom>b4mom)&&(mom>98.6591)&&(lastAlerted!=Time[0])&&(AlertType1!="Buy")){

ExtMapBuffer1=High+5*Point。

}否则

ExtMapBuffer1=0.0。

Alert(Symbol()," ",Period(), "M Price UP")。

//卖出警报

if((ema5<ema13)&&(ema5<b4ema5)&&(ema13<b4ema13)&&(mom<b4mom)&&(mom<100.6872)&&(lastAlerted!=Time[0])&&(AlertType2!="Sell")){

ExtMapBuffer2=Low-5*Point。

}否则

ExtMapBuffer2=0.0。

Alert(Symbol()," ",Period(), "M价格下跌")。

返回(0)。

}

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

试着把最后的警报类型保存为AlertType1或AlertType2(你从来没有保存过最后的警报类型,也没有保存过最后的警报是什么时候触发的)。

 

你好。

我想把实际时间放在我的图表上(每一秒)。我把它放在一个infinit循环中。

但它并不像我想的那样工作 :-(

为什么?

这是我的代码。

while(!IsStopped())

{

ObjectMove ("Time", OBJ_TEXT,0,Time[0],High[0]+2*pips2dbl);

ObjectSetText("Time",TimeToStr(TimeCurrent()),10,"Tahoma",Gray);

Sleep(100);

}

 
sunshineh:
你好。

我想把实际时间放在我的图表上(每一秒)。我把它放在一个infinit循环中。

但它并不像我想的那样工作 :-(

为什么?

这是我的代码。

while(!IsStopped())

{

ObjectMove ("Time", OBJ_TEXT,0,Time[0],High[0]+2*pips2dbl);

ObjectSetText("Time",TimeToStr(TimeCurrent()),10,"Tahoma",Gray);

Sleep(100);

}

sunshineh

这只能在EA中工作

Sleep()在指标中不起作用

 

谢谢mladen。

但是,我如何实现实际时间显示在图表上?

即使我把这段代码放在我的EA中,"时间 "对象也不是每秒钟都在更新。为什么?更新文本对象 要花很多时间吗?

但这对我来说不是一个解决方案。也许可以为指标 "创建 "刻度线,这样它就可以每秒更新一次。