Job finished
Execution time 17 hours
Feedback from employee
Cliente muito compreensivo :), espero ter mais negócios com ele!
Feedback from customer
Desenvolvedor rápido atencioso muito educado. com certeza recomendo a toda comunidade.
Specification
Olá, eu preciso de um desenvolvedor experiente em MQL5 para corrigir um código de Expert Advisor que está com erros de compilação. O código é para uma estratégia baseada no indicador MACD e tem parâmetros de risco definidos pelo usuário. O código está anexado a este pedido. Por favor, me diga quanto tempo e quanto custa para fazer esse trabalho.
#define MagicNumber 12345 //--- #include <Trade\Trade.mqh> #include <Trade\SymbolInfo.mqh> #include <Trade\PositionInfo.mqh> #include <Trade\AccountInfo.mqh> // Parâmetros de entrada input int MagicNumber = 12345; // Número mágico para identificar as operações do robô input double RiskPercentage = 1.0; // Percentual de risco por operação (1.0 = 1%) input int StopLoss = 20; // Valor do stop-loss em pips input int TakeProfit = 30; // Valor do take-profit em pips // Função de inicialização do robô int OnInit() { // Definir o risco por operação com base no saldo da conta double AccountBalance = AccountBalance(); double RiskAmount = AccountBalance * RiskPercentage / 100.0; double OneLotValue = MarketInfo(Symbol(), MODE_TICKVALUE); // Definir o tamanho do lote com base no risco por operação e no valor de um lote double LotSize = RiskAmount / (OneLotValue * StopLoss); // Definir as configurações do risco SetRiskParameters(Symbol(), StopLoss, TakeProfit, LotSize); return (INIT_SUCCEEDED); } // Função para abrir uma posição de compra void BuySignal() { // Verificar se não há nenhuma posição aberta if (PositionsTotal() == 0) { // Gerar sinal de compra do MACD if (iMACD(Symbol(), 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1) > iMACD(Symbol(), 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 1)) { // Calcular o tamanho do lote com base no risco por operação double LotSize = GetRiskLotSize(Symbol()); // Abrir uma posição de compra int ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, 3, Bid - StopLoss * Point, Bid + TakeProfit * Point, "Buy", MagicNumber, 0, Blue); } } } // Função para abrir uma posição de venda void SellSignal() { // Verificar se não há nenhuma posição aberta if (PositionsTotal() == 0) { // Gerar sinal de venda do MACD if (iMACD(Symbol(), 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1) < iMACD(Symbol(), 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 1)) { // Calcular o tamanho do lote com base no risco por operação double LotSize = GetRiskLotSize(Symbol()); // Abrir uma posição de venda int ticket = OrderSend(Symbol(), OP_SELL, LotSize, Bid, 3, Ask + StopLoss * Point, Ask - TakeProfit * Point, "Sell", MagicNumber, 0, Red); } } } // Função para gerenciar o risco da posição void SetRiskParameters(string symbol, int stopLoss, int takeProfit, double lotSize) { // Definir as configurações de stop-loss e take-profit int slippage = MarketInfo(symbol, MODE_SPREAD) + StopLevel * Point; double stopLossPrice = stopLoss * Point; double takeProfitPrice = takeProfit * Point; // Definir as configurações de risco para a posição atual for (int i = 0; i < OrdersTotal(); i++) { if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == symbol && OrderMagicNumber() == MagicNumber) { if (OrderType() == OP_BUY) { OrderModify(OrderTicket(), OrderOpenPrice(), stopLossPrice, takeProfitPrice, 0, Blue); } else if (OrderType() == OP_SELL) { OrderModify(OrderTicket(), OrderOpenPrice(), stopLossPrice, takeProfitPrice, 0, Red); } } } } } // Função para calcular o tamanho do lote com base no risco por operação double GetRiskLotSize(string symbol) { double AccountBalance = AccountBalance(); double RiskAmount = AccountBalance * RiskPercentage / 100.0; double OneLotValue = MarketInfo(symbol, MODE_TICKVALUE); double LotSize = RiskAmount / (OneLotValue * StopLoss); return LotSize; } // Função de execução contínua do robô void OnTick() { // Verificar os sinais de entrada BuySignal(); SellSignal(); } // Função de encerramento do robô void OnDeinit(const int reason) { // Encerrar todas as posições abertas for (int i = PositionsTotal() - 1; i >= 0; i--) { if (PositionSelectByTicket(PositionGetTicket(i))) { if (PositionMagicNumber() == MagicNumber) { OrderClose(PositionGetTicket(i), PositionGetDouble(POSITION_VOLUME), PositionGetDouble(POSITION_CLOSE), 3, Violet); } } } }
Obrigado.
Responded
1
Rating
Projects
51
8%
Arbitration
0
Overdue
0
Free
2
Rating
Projects
945
47%
Arbitration
309
58%
/
27%
Overdue
125
13%
Free
3
Rating
Projects
240
34%
Arbitration
20
45%
/
30%
Overdue
3
1%
Free
4
Rating
Projects
79
11%
Arbitration
4
25%
/
75%
Overdue
2
3%
Free
5
Rating
Projects
17
59%
Arbitration
2
0%
/
100%
Overdue
2
12%
Free
6
Rating
Projects
7
14%
Arbitration
1
100%
/
0%
Overdue
0
Free
Published: 1 code
7
Rating
Projects
478
40%
Arbitration
105
40%
/
24%
Overdue
82
17%
Loaded
Published: 2 codes
Similar orders
Frete de Markets
30+ USD
Vamos aprender a operar no mercado Forex vamos aprender vamos trabalhar no mercado Forex vamos temos tudo para dar certo só trabalho só com trabalho podemos fazer tudo para nossa vida
Project information
Budget
30+ USD