初学MQL,请帮我纠错
//+------------------------------------------------------------------+
//| ob try.mq4 |
//| Copyright ?2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2006, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
int i=ObjectsTotal();
int typ;
string name;
name=ObjectName(i);
typ=ObjectType(name);
Print("total:" + i);
Print("the last object name:" + name);
Print("Type" + typ);
//----
// return(0);
}
//+------------------------------------------------------------------+
如上指标, 应该显示我的图上的趋势线(仅有2条)的数量,以及最后一条的名字,类型.......
数量对了.但名字为空. type=-1
名字这里有什么问题?