Tâche terminée
Temps d'exécution 17 heures
Commentaires de l'employé
Cliente muito compreensivo :), espero ter mais negócios com ele!
Commentaires du client
Desenvolvedor rápido atencioso muito educado. com certeza recomendo a toda comunidade.
Spécifications
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.
Répondu
1
Évaluation
Projets
51
8%
Arbitrage
0
En retard
0
Gratuit
2
Évaluation
Projets
945
47%
Arbitrage
309
58%
/
27%
En retard
125
13%
Gratuit
3
Évaluation
Projets
240
34%
Arbitrage
20
45%
/
30%
En retard
3
1%
Gratuit
4
Évaluation
Projets
79
11%
Arbitrage
4
25%
/
75%
En retard
2
3%
Gratuit
5
Évaluation
Projets
17
59%
Arbitrage
2
0%
/
100%
En retard
2
12%
Gratuit
6
Évaluation
Projets
7
14%
Arbitrage
1
100%
/
0%
En retard
0
Gratuit
Publié : 1 code
7
Évaluation
Projets
478
40%
Arbitrage
105
40%
/
24%
En retard
82
17%
Chargé
Publié : 2 codes
Commandes similaires
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
Informations sur le projet
Budget
30+ USD