Vadym Dubenko:
Здравствуйте. Не могу понять, почему при Backtest експерт совершает десятки сделок в день, а при проведении Forwardtest на демо - не совершает ни одной? За любую помощь буду благодарен. Заранее спасибо.
а что в журнал пишет ?
и кстати, 1) SL TP надо нормализовать 2) покупают по ask, продают по bid, а не по high/low текущей свечи :-)
Maxim Kuznetsov #:
а что в журнал пишет ?
а что в журнал пишет ?
А вот в том-то и дело, что журнал просто молчит. Пусто и в журнале, и в Эксперте. Был вчера момент, когда я повставлял принты на все условия входа в сделку и он пару сделок выполнил. Но потом снова замолчал. Это меня еще больше запутало.
P.S. Мне нужно весь код выложить для понимания структуры или это будет лишним? Maxim Kuznetsov #:
2) покупают по ask, продают по bid, а не по high/low текущей свечи :-)
2) покупают по ask, продают по bid, а не по high/low текущей свечи :-)
// Function to place a sell order (on bid price) bool PlaceSellOrder() { double currentPrice = Bid; // Use the Bid price for sell orders // Check if current price is 1 point or more below the previous candle's low double previousLow = iLow(NULL, 0, 1); if (currentPrice < previousLow - Point) { double sl = currentPrice + StopLossPoints * Point; double tp = currentPrice - TakeProfitPoints * Point; int ticket = OrderSend(Symbol(), OP_SELL, LotSize, currentPrice, Slippage, sl, tp, "", 0, 0, Red); if (ticket < 0) { LogError("Sell order failed", GetLastError()); return false; } return true; } return false; // No sell order placed if condition is not met } // Function to place a buy order (on ask price) bool PlaceBuyOrder() { double currentPrice = Ask; // Use the Ask price for buy orders // Check if current price is 1 point or more above the previous candle's high double previousHigh = iHigh(NULL, 0, 1); if (currentPrice > previousHigh + Point) { double sl = currentPrice - StopLossPoints * Point; double tp = currentPrice + TakeProfitPoints * Point; int ticket = OrderSend(Symbol(), OP_BUY, LotSize, currentPrice, Slippage, sl, tp, "", 0, 0, Blue); if (ticket < 0) { LogError("Buy order failed", GetLastError()); return false; } return true; } return false; // No buy order placed if condition is not met }
Maxim Kuznetsov #:
1) SL TP надо нормализовать
1) SL TP надо нормализовать
// External variables that can be set by the trader extern double TakeProfitPoints = 50; // Take Profit in points extern double StopLossPoints = 50; // Stop Loss in points extern double BreakevenPoints = 50; // Points in profit when Stop Loss is moved to Breakeven extern double TrailStopDistance = 50; // Trailing Stop distance in points extern double MinPriceMove = 50; // Minimum price move in consecutive candles before entering extern double LotSize = 0.01; // Fixed lot size extern int Slippage = 20; // Define slippage (in points)Или вы что-то другое имели ввиду?
Maxim Kuznetsov #:
1) SL TP надо нормализовать
1) SL TP надо нормализовать
Я нашел о чем вы говорите. Спасибо за совет. Финальная версия кода выглядит теперь вот так:
// Function to place a sell order using MqlTick for Bid price with normalized stop loss and take profit bool PlaceSellOrder() { MqlTick tick; SymbolInfoTick(_Symbol, tick); // Get the latest tick data double price = tick.bid; // Use Bid price from the terminal, no need to normalize double sl = NormalizePrice(price + StopLossPoints * Point); // Normalize Stop Loss double tp = NormalizePrice(price - TakeProfitPoints * Point); // Normalize Take Profit double lotSize = NormalizeLots(LotSize); // Normalize lot size if (lotSize == 0) { Print("Error: Lot size too small."); return false; } int ticket = OrderSend(Symbol(), OP_SELL, lotSize, price, Slippage, sl, tp, "", 0, 0, Red); if (ticket < 0) { LogError("Sell order failed", GetLastError()); return false; } return true; } // Function to place a buy order using MqlTick for Ask price with normalized stop loss and take profit bool PlaceBuyOrder() { MqlTick tick; SymbolInfoTick(_Symbol, tick); // Get the latest tick data double price = tick.ask; // Use Ask price from the terminal, no need to normalize double sl = NormalizePrice(price - StopLossPoints * Point); // Normalize Stop Loss double tp = NormalizePrice(price + TakeProfitPoints * Point); // Normalize Take Profit double lotSize = NormalizeLots(LotSize); // Normalize lot size if (lotSize == 0) { Print("Error: Lot size too small."); return false; } int ticket = OrderSend(Symbol(), OP_BUY, lotSize, price, Slippage, sl, tp, "", 0, 0, Blue); if (ticket < 0) { LogError("Buy order failed", GetLastError()); return false; } return true; }

Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
Здравствуйте. Не могу понять, почему при Backtest експерт совершает десятки сделок в день, а при проведении Forwardtest на демо - не совершает ни одной? За любую помощь буду благодарен. Заранее спасибо.