//--- 입력 매개변수
input uint InpBars = 100000; // 원하는 바의 수
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- 서버에서 사용 가능한 바의 수를 가져옵니다.
uint bars_total = Bars(Symbol(),Period());
if(bars_total==0)
{
PrintFormat("Data for timeseries %s %s not yet generated in the terminal. Please try again later.",Symbol(),StringSubstr(EnumToString(Period()),7));
return;
}
//--- 두 값(서버에서 사용 가능한 값과 설정에서 요청한 값)에서 최소 바의 수를 가져옵니다.
int bars = (int)MathMin(bars_total,InpBars);
//--- 서버에서 사용할 수 있는 것보다 더 많은 바가 요청되면 이를 저널에 보고합니다.
if(bars_total<InpBars)
PrintFormat("Number of bars on the server (%u) is less than requested (%u)",bars_total,InpBars);
//--- 저널에서 작업에 사용할 수 있는 바의 수를 표시합니다.
Print("Bars available for work: ",bars);
}
|