Error ';' - open parenthesis expected New comment Renan Magalhaes 2023.08.26 21:26 //+------------------------------------------------------------------+ //| Comprar na Resistência / Vender na Suporte.mq5 | //| | //| | //+------------------------------------------------------------------+ #property strict #include <datetime.mqh> // Parâmetros input int MagicNumber = 123456; input double StopLoss = 40; input double TakeProfit = 560; input int Slippage = 5; input int NumCandles = 9; input int MaxOrdersPerDay = 5; input double X = 0.001; // Defina o valor de X aqui input double Lots = 0.1; // Defina o tamanho do lote aqui input int StartHour = 14; input int StartMinute = 25; input int ResetHour = 22; input int ResetMinute = 50; // Variáveis double previousClose[]; datetime lastBarTime = 0; int OrdersOpenedToday = 0; bool IsTradingAllowed() { return true; // Você pode definir condições de negociação aqui } bool CanOpenNewOrder() { return OrdersOpenedToday < MaxOrdersPerDay; } void OpenEntries(double lotSize) { double ask = SymbolInfoDouble(Symbol(), SYMBOL_ASK); double bid = SymbolInfoDouble(Symbol(), SYMBOL_BID); if (previousClose[0] > previousClose[1] + X) { MqlTradeRequest request; MqlTradeResult result; ZeroMemory(request); request.action = TRADE_ACTION_DEAL; request.symbol = Symbol(); request.volume = lotSize; request.type = ORDER_TYPE_BUY; request.price = ask; request.sl = ask - StopLoss * Point; request.tp = ask + TakeProfit * Point; request.deviation = Slippage; request.magic = MagicNumber; if (OrderSend(request, result)) { Print("Ordem de compra aberta. Bilhete: ", result.deal); OrdersOpenedToday++; } else { Print("Falha ao abrir ordem de compra. Código de erro: ", result.retcode); } } else if (previousClose[0] < previousClose[1] - X) { MqlTradeRequest request; MqlTradeResult result; ZeroMemory(request); request.action = TRADE_ACTION_DEAL; request.symbol = Symbol(); request.volume = lotSize; request.type = ORDER_TYPE_SELL; request.price = bid; request.sl = bid + StopLoss * Point; request.tp = bid - TakeProfit * Point; request.deviation = Slippage; request.magic = MagicNumber; if (OrderSend(request, result)) { Print("Ordem de venda aberta. Bilhete: ", result.deal); OrdersOpenedToday++; } else { Print("Falha ao abrir ordem de venda. Código de erro: ", result.retcode); } } CopyClose(Symbol(), Period(), 0, NumCandles, previousClose); } void OnTick() { if (!IsTradingAllowed()) { return; } datetime horarioAtual = TimeCurrent(); int ultimaBarra = iBarShift(Symbol(), Period(), lastBarTime); if (ultimaBarra < 0) { return; // Sem novas barras } lastBarTime = iTime(Symbol(), Period(), ultimaBarra); if (CanOpenNewOrder()) { double fechamentoAtual = SymbolInfoDouble(Symbol(), SYMBOL_LAST); if (previousClose[0] > previousClose[1] + X) { OpenEntries(Lots); } else if (previousClose[0] < previousClose[1] - X) { OpenEntries(-Lots); } } } void OnInit() { lastBarTime = iTime(Symbol(), Period(), 0); OrdersOpenedToday = 0; } void OnDeinit(const int reason) { OrdersOpenedToday = 0; } Can anyone help me fix these errors that I'm not finding in the code. ';' - open parenthesis expected novo 3.txt.mq5 53 44 ';' - open parenthesis expected novo 3.txt.mq5 54 46 ';' - open parenthesis expected novo 3.txt.mq5 77 44 ';' - open parenthesis expected novo 3.txt.mq5 78 46 Carl Schreiber 2023.08.26 21:39 #1 And where are the lines and the char. counts? Is you want help don't create a brainteaser. New comment
Can anyone help me fix these errors that I'm not finding in the code.
';' - open parenthesis expected novo 3.txt.mq5 53 44
';' - open parenthesis expected novo 3.txt.mq5 54 46
';' - open parenthesis expected novo 3.txt.mq5 77 44
';' - open parenthesis expected novo 3.txt.mq5 78 46