下载MetaTrader 5
要添加评论,请登录注册
开始使用市场获利。发布您的产品!
samwongwmf
20
samwongwmf 2010.03.05 05:23 
您好!

請教mt4編程可以嗎!


請問怎樣在編程裡加上這個Label

如附件 www.xxx.com

請覆!謝謝!QQ:200816175



samwongwmf
20
samwongwmf 2010.03.05 06:38  
Samwmf 写道 >>
您好!

請教mt4編程可以嗎!


請問怎樣在編程裡加上這個Label

如附件 www.xxx.com

請覆!謝謝!QQ:200816175

请问有高手免费写這個Label吗?

請教mt4編程可以嗎!


請問怎樣在編程裡加上這個Label

如附件 www.xxx.com

trad
44
trad 2010.03.05 06:45  
Hi, infowkjew
please add this code into your source, and you will see it in chart.

extern string right_string = "www.xxx.com";
 
int init()
{
   ObjectCreate("right_string",OBJ_LABEL,0,0,0,0);
   ObjectSetText("right_string", right_string, 24, "Times New Roman", Green);
   return(0);
}
 
int deinit()
{
   //----
   ObjectDelete("right_string");
   //----
   return(0);
}
samwongwmf
20
samwongwmf 2010.03.06 03:43  
Samwmf 写道 >>
您好!

請教mt4編程可以嗎!


請問怎樣在編程裡加上這個Label

如附件 www.xxx.com

請覆!謝謝!QQ:200816175



hi,

請問是這樣嗎!

Steven


#property copyright "Copyright ?2010, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
extern string right_string = "www.xxx.com";

int init()
{
ObjectCreate("right_string",OBJ_LABEL,0,0,0,0);
ObjectSetText("right_string", right_string, 24, "Times New Roman", Green);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
iint deinit()
{
//----
ObjectDelete("right_string");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----

//----
return(0);
}
//+------------------------------------------------------------------+
trad
44
trad 2010.03.06 04:22  

代码中有一个错误:应该是int,而不是iint,这是其一;

其二是源代码要放在......\experts\indicators下面;

如果编译成功后还是不显示,就切换时间段看看。

//+------------------------------------------------------------------+
//|                                                         logo.mq4 |
//|                       Copyright ?2010, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2010, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
extern string right_string = "www.xxx.com";
 
int init()
{
   ObjectCreate("right_string",OBJ_LABEL,0,0,0,0);
   ObjectSetText("right_string", right_string, 24, "Times New Roman", Green);
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   //----
   ObjectDelete("right_string");
   //----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+-------------+
samwongwmf
20
samwongwmf 2010.03.08 11:49  

謝謝!師兄指點!現在可以了!


請教下!如要加在新編程上!請問加在那個位置才對!謝謝!


//+------------------------------------------------------------------+
//| Magnified Market Price.mq4 ver1.4 by Habeeb |
//| Modified by FerruFX for Cobraforex THV System, www.cobraforex.com|
//+------------------------------------------------------------------+
#property indicator_chart_window
//----
extern string note1="Change font colors automatically? True = Yes";
extern bool Bid_Ask_Colors=True;
extern string note2="Default Font Color";
extern color FontColor=Black;
extern string note3="Font Size";
extern int FontSize=32;
extern string note4="Font Type";
extern string FontType="Arial Black";
extern string note5="Display the price in what corner?";
extern string note6="Upper left=0; Upper right=1";
extern string note7="Lower left=2; Lower right=3";
extern int WhatCorner=1;
//----
double Old_Price;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("Market_Price_Label");
//----
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
if (Bid_Ask_Colors==True)
{
if (Bid > Old_Price) FontColor=LawnGreen;
if (Bid < Old_Price) FontColor=Red;
Old_Price=Bid;
}

//---- Define the standard digits
int digits;
string sub=StringSubstr(Symbol(), 3, 3);
if(sub == "JPY") digits = 2;
else digits = 4;

string Market_Price=DoubleToStr(Bid, digits);
//----
ObjectCreate("Market_Price_Label", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Market_Price_Label", Market_Price, FontSize, FontType, FontColor);
ObjectSet("Market_Price_Label", OBJPROP_CORNER, WhatCorner);
ObjectSet("Market_Price_Label", OBJPROP_XDISTANCE, 1);
ObjectSet("Market_Price_Label", OBJPROP_YDISTANCE, 1);
}
//+------------------------------------------------------------------+

trad
44
trad 2010.03.09 14:07  
邮件已回。
/
要添加评论,请登录注册