Sergey Kovalyov
Элитный участник
Как померять проскальзывание. Debug меняем на Print.
Переменные
bool close = false;
int ticks, ticket, type;
double slippage, price;
надо описать.
symb меняем на Symbol()
Переменные
bool close = false;
int ticks, ticket, type;
double slippage, price;
надо описать.
symb меняем на Symbol()
PHP:
ticks = GetTickCount();
if (type == OP_BUY) {
RefreshRates();
price = Ask;
Debug("going to BUY: " + DoubleToStr(lot, 2) + " ask: " + DoubleToStr(price, Digits));
ticket = OrderSend(symb, OP_BUY, lot, Ask, 0, 0, 0);
} else if (type == OP_SELL) {
RefreshRates();
price = Bid;
Debug("going to SELL: " + DoubleToStr(lot, 2) + " bid: " + DoubleToStr(price, Digits));
ticket = OrderSend(symb, OP_SELL, lot, Bid, 0, 0, 0);
}
if (ticket != 0) {
OrderSelect(ticket, SELECT_BY_TICKET);
if (close) {
slippage = price - OrderClosePrice();
if (type == OP_BUY) slippage = -slippage;
} else {
slippage = price - OrderOpenPrice();
if (type == OP_SELL) slippage = -slippage;
}
Debug(""
+ "ticket #" + ticket
+ " ms: " + (GetTickCount() - ticks)
+ " slip: " + DoubleToStr(slippage / Point, 0)
+ " cmnt: " + OrderComment()
);
}
Последнее редактирование: