//---
if (TimeBar==iTime(NULL,timeframe_RSI,0)) return;
double Lots=0,RSI1=0,RSI0=0;
//---
if (b==0 || s==0)
{
RSI0= iRSI (NULL,timeframe_RSI,period_RSI,PRICE_CLOSE,0);
RSI1= iRSI (NULL,timeframe_RSI,period_RSI,PRICE_CLOSE,1);
}
if((b==0 && !StopBuy) || b>0)
if (RSI0>=level_buy && RSI1<=level_buy)
{
if ((MinOrderBuy-MinStep*Point>Ask || MinOrderBuy==0))
{
Lots=NormalizeDouble(Lot*MathPow(K_Lot,b),DigitsLot);
if (Lots>MAXLOT) Lots = MAXLOT;
if (Lots<MINLOT) Lots = MINLOT;
if (OrderSend(Symbol(),OP_BUY, Lots,NormalizeDouble(Ask,Digits),slippage,0,0,NULL,Magic,0,CLR_NONE)==-1)
Print("Ошибка ",GetLastError()," открытия ордера ");
else TimeBar=iTime(NULL,timeframe_RSI,0);
}
}