Why it doesn't work?

 

/+------------------------------------------------------------------+
//|                                                         test.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   if(ChartSetInteger(0,CHART_FIRST_VISIBLE_BAR,1000))
     Print(ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR));
     else
       Print("ERROR");

  }
//+------------------------------------------------------------------+

It should print out 1000,but not ,why? 
自动交易和策略测试
自动交易和策略测试
  • www.mql5.com
MQL5:MetaTrader 5客户端内置的交易策略语言。语言允许编写您自己的自动交易系统,技术指标,脚本和函数程序库
 
bcsunwww:


It should print out 1000,but not ,why? 

See documentation, you can't set this property, it's read-only :

CHART_FIRST_VISIBLE_BAR

Number of the first visible bar in the chart. Indexing of bars is the same as for timeseries.

int r/o

 
angevoyageur:

See documentation, you can't set this property, it's read-only :

CHART_FIRST_VISIBLE_BAR

Number of the first visible bar in the chart. Indexing of bars is the same as for timeseries.

int r/o

Thank you very much.
Reason: