#property copyright "Copyright ?2007, 520FX Corp."
#property link "http://www.520fx.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
double Ma[];
extern int N=20;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(1);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Ma);
//----
Del();
return(0);
}
int start()
{
int i;
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars0) counted_bars--;
limit=Bars-counted_bars;
for (i=limit-1;i>=0;i--)
{
Ma<i>=iMA(NULL,0,N,0,MODE_SMA,PRICE_CLOSE,i);
}
Write();
return(0);
}
void Write()
{
writetext("均线价格",DoubleToStr(Ma[0],Digits),10,15,Yellow,12);
}
void Del()
{
ObjectDelete("均线价格");
}
void writetext(string Labelname,string data,int x,int y,color ColorValue,int FontSize)//通过Object写文字
{
ObjectDelete(Labelname);
ObjectCreate(Labelname, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Labelname, data, FontSize, "Arial", ColorValue);
ObjectSet(Labelname, OBJPROP_CORNER, 0);
ObjectSet(Labelname, OBJPROP_XDISTANCE, x);
ObjectSet(Labelname, OBJPROP_YDISTANCE, y);
}
帮我把里面的代码改下,改成这个图这样 价格显示在均线末端的?file:///C:Documents and SettingsAdministratorApplication DataTencentUsers23692983QQWinTempRichOle}(3A7Z_R$C6@O%2DWH)@685.jpg 2012-10-11 22:07 上传
下载附件 (55.19 KB) |