|
|
void OnStart()
{
if(InpDate<0 || InpDate>100 || InpPrice<0 || InpPrice>100)
{
return;
}
int bars=(int)ChartGetInteger(0,CHART_VISIBLE_BARS);
int accuracy=1000;
datetime date[];
double price[];
ArrayResize(date,bars);
ArrayResize(price,accuracy);
ResetLastError();
if(CopyTime(Symbol(),Period(),0,bars,date)==-1)
{
return;
}
double max_price=ChartGetDouble(0,CHART_PRICE_MAX);
double min_price=ChartGetDouble(0,CHART_PRICE_MIN);
double step=(max_price-min_price)/accuracy;
for(int i=0;i<accuracy;i++)
price=min_price+i*step;
int d=InpDate*(bars-1)/100;
int p=InpPrice*(accuracy-1)/100;
if(!ArrowLeftPriceCreate(0,InpName,0,date[d],price[p],InpColor,
InpStyle,InpWidth,InpBack,InpSelection,InpHidden,InpZOrder))
{
return;
}
ChartRedraw();
Sleep(1000);
int v_steps=accuracy*4/5;
for(int i=0;i<v_steps;i++)
{
if(p<accuracy-1)
p+=1;
if(!ArrowLeftPriceMove(0,InpName,date[d],price[p]))
return;
if(IsStopped())
return;
ChartRedraw();
}
Sleep(1000);
ArrowLeftPriceDelete(0,InpName);
ChartRedraw();
Sleep(1000);
}复制代码 |
|