If(AccountDataExist() And IsTradingTime(SystemDateTime) And flag==0 And A_BuyPosition<11)
{
Commentary("flag="+Text(flag));
For i = 1 To gridlength
{
curgridprice = gridstartprice-(i-1)*gridstep;
If(A_SendOrderEx(Enum_Buy,Enum_Entry,1,curgridprice,orderIDs))
{
flag=1;
//FileAppend
}
}
}
}