Tâche terminée
Temps d'exécution 3 heures
Commentaires de l'employé
Amazing Customer, Very fast replying and testing! I'm looking forward to future work with him. Very easy to work with Rafael!
Commentaires du client
Perfect job! Better than expected, this guy even made the code better than it was before... I will definitely hire him again. Thanks bro!!
Spécifications
I would like to add a function to my simple GannHilo EA.
I would like for each new hilo signal to check how many signals there were in a range of X previous bars closed, and if the number of previous signals in this range is equal to Y, then it enables trading as a filter, with the type filter bool. This filter, once activated, must be deactivated when a trade reaches the take profit line, then returning to check the number of signals again for a new entry.
The function must only consider bars, regardless of time. Thanks!
//+------------------------------------------------------------------+ //| Canais01.mq5 | //| Copyright 2023, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2023, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" #include <Trade\Trade.mqh> #include <Trade\SymbolInfo.mqh> CTrade trade; CSymbolInfo simbolo; input int Periodo = 20; // Período Média //input int PeriodoCurto = 20; // Período Média Curta input double SL = 0.0; // Stop Loss input double TP = 0.0; // Take Profit input double lotes = 1; // Volume Inicial input string inicio = "09:00"; // Horário de Início (entradas) input string termino = "17:00"; // Horário de Término (entradas) input string fechamento = "17:30"; // Horário de Fechamento (posições) input int periodo_verificacao = 10; // verifica input int alternanciaMinima = 1; bool HabilitarVenda = true; bool HabilitarCompra = true; int count_above_ma = 0; int handleHilo; // Manipuladores dos dois indicadores de média móvel double hilo[]; // Estruturas de tempo para manipulação de horários MqlDateTime horario_inicio, horario_termino, horario_fechamento, horario_atual; MqlRates rates[]; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- if(!simbolo.Name(_Symbol)) { printf("Ativo Inválido!"); return INIT_FAILED; } // Criação dos manipuladores com Períodos curto e longo // Criação das structs de tempo TimeToStruct(StringToTime(inicio), horario_inicio); TimeToStruct(StringToTime(termino), horario_termino); TimeToStruct(StringToTime(fechamento), horario_fechamento); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { handleHilo = iCustom(Symbol(), Period(), "GannHilo", Periodo); // Cópia dos buffers dos indicadores de média móvel com períodos curto e longo ArraySetAsSeries(hilo, true); ArraySetAsSeries(rates, true); CopyBuffer(handleHilo, 0, 0, 3, hilo); CopyRates(Symbol(), Period(), 0, 3, rates); //--- if(HorarioEntrada()) { // Compra em caso de cruzamento da média curta para cima da média longa if(rates[1].close > hilo[1] && rates[2].close < hilo[2] && HabilitarCompra == true){ //double ma_value = hilo[0]; // Verificar quantas vezes os últimos 10 candles fecharam acima da média móvel //count_above_ma = 0; CloseAllSellPositions(); Compra(); HabilitarCompra = false; HabilitarVenda = true; } // Venda em caso de cruzamento da média curta para baixo da média longa else if(rates[1].close < hilo[1] && rates[2].close > hilo[2] && HabilitarVenda == true){ CloseAllBuyPositions(); Venda(); HabilitarVenda = false; HabilitarCompra = true; } // EA está posicionado /* if(!SemPosicao()) { BreakEven(); }*/ //} // EA em horário de fechamento de posições abertas if(HorarioFechamento()) { // EA está posicionado, fechar posição if(!SemPosicao()/* || !SemOrdem()*/) Fechar(); } } } //fecha ontick //+------------------------------------------------------------------+ //| Checar se horário atual está dentro do horário de entradas | //+------------------------------------------------------------------+ bool HorarioEntrada() { TimeToStruct(TimeCurrent(), horario_atual); // Obtenção do horário atual // Hora dentro do horário de entradas if(horario_atual.hour >= horario_inicio.hour && horario_atual.hour <= horario_termino.hour) { // Hora atual igual a de início if(horario_atual.hour == horario_inicio.hour) // Se minuto atual maior ou igual ao de início => está no horário de entradas if(horario_atual.min >= horario_inicio.min) return true; // Do contrário não está no horário de entradas else return false; // Hora atual igual a de término if(horario_atual.hour == horario_termino.hour) // Se minuto atual menor ou igual ao de término => está no horário de entradas if(horario_atual.min <= horario_termino.min) return true; // Do contrário não está no horário de entradas else return false; // Hora atual maior que a de início e menor que a de término return true; } // Hora fora do horário de entradas return false; } //+------------------------------------------------------------------+ //| Checar se horário atual está dentro do horário de fechamento | //+------------------------------------------------------------------+ bool HorarioFechamento() { TimeToStruct(TimeCurrent(), horario_atual); // Obtenção do horário atual // Hora dentro do horário de fechamento if(horario_atual.hour >= horario_fechamento.hour) { // Hora atual igual a de fechamento if(horario_atual.hour == horario_fechamento.hour) // Se minuto atual maior ou igual ao de fechamento => está no horário de fechamento if(horario_atual.min >= horario_fechamento.min) return true; // Do contrário não está no horário de fechamento else return false; // Hora atual maior que a de fechamento return true; } // Hora fora do horário de fechamento return false; } void Compra() { if(trade.Buy(lotes, NULL, 0, 0, 0, "Compra CruzamentoMediaEA")) // Envio da ordem de compra pela classe responsável { AddTakeStop(SL, TP); } } void Venda() { if(trade.Sell(lotes, NULL, 0, 0, 0, "venda CruzamentoMediaEA")) // Envio da ordem de compra pela classe responsável { AddTakeStop(SL, TP); } } void AddTakeStop(double p_sl, double p_tp) { for (int i = PositionsTotal() - 1; i >= 0; i--) { string symbol = PositionGetSymbol(i); if (symbol == Symbol()) { ulong ticket = PositionGetInteger(POSITION_TICKET); double precoEntrada = PositionGetDouble(POSITION_PRICE_OPEN); double novoSL; double novoTP; if (PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) { novoSL = NormalizeDouble(precoEntrada - (p_sl * _Point), _Digits); novoTP = NormalizeDouble(precoEntrada + (p_tp * _Point), _Digits); trade.PositionModify(ticket, novoSL, novoTP); } else if (PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL) { novoSL = NormalizeDouble(precoEntrada + (p_sl * _Point), _Digits); novoTP = NormalizeDouble(precoEntrada - (p_tp * _Point), _Digits); trade.PositionModify(ticket, novoSL, novoTP); } } } } //+------------------------------------------------------------------+ //| Fechar posição aberta | //+------------------------------------------------------------------+ void Fechar() { for (int i = PositionsTotal() - 1; i >= 0; i--) { if (PositionGetSymbol(i) == _Symbol && PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) { ulong ticket = PositionGetTicket(i); trade.PositionClose(ticket); } } for (int i = PositionsTotal() - 1; i >= 0; i--) { if (PositionGetSymbol(i) == _Symbol && PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL) { ulong ticket = PositionGetTicket(i); trade.PositionClose(ticket); } } } void CloseAllBuyPositions() { for (int i = PositionsTotal() - 1; i >= 0; i--) { if (PositionGetSymbol(i) == _Symbol && PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) { ulong ticket = PositionGetTicket(i); trade.PositionClose(ticket); } } } void CloseAllSellPositions() { for (int i = PositionsTotal() - 1; i >= 0; i--) { if (PositionGetSymbol(i) == _Symbol && PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL) { ulong ticket = PositionGetTicket(i); trade.PositionClose(ticket); } } } //+------------------------------------------------------------------+ //| Verificar se há posição aberta | //+------------------------------------------------------------------+ bool SemPosicao() { return !PositionSelect(_Symbol); //return resultado; } //+------------------------------------------------------------------+ //| Estratégia de cruzamento de médias | //+------------------------------------------------------------------+ /*int Cruzamento() { // Cópia dos buffers dos indicadores de média móvel com períodos curto e longo double MediaCurta[], MediaLonga[]; ArraySetAsSeries(MediaCurta, true); ArraySetAsSeries(MediaLonga, true); CopyBuffer(handlemediacurta, 0, 0, 2, MediaCurta); CopyBuffer(handlemedialonga, 0, 0, 2, MediaLonga); // Compra em caso de cruzamento da média curta para cima da média longa if(MediaCurta[1] <= MediaLonga[1] && MediaCurta[0] > MediaLonga[0]){ CloseAllBuyPositions(); return 1; tradar = 1; } // Venda em caso de cruzamento da média curta para baixo da média longa if(MediaCurta[1] >= MediaLonga[1] && MediaCurta[0] < MediaLonga[0]){ return -1; CloseAllSellPositions();} return 0; }*/ //+------------------------------------------------------------------+
Répondu
1
Évaluation
Projets
191
26%
Arbitrage
8
25%
/
38%
En retard
5
3%
Occupé
2
Évaluation
Projets
26
27%
Arbitrage
3
0%
/
0%
En retard
1
4%
Chargé
3
Évaluation
Projets
546
25%
Arbitrage
21
38%
/
38%
En retard
83
15%
Travail
4
Évaluation
Projets
0
0%
Arbitrage
1
0%
/
100%
En retard
0
Gratuit
5
Évaluation
Projets
1
0%
Arbitrage
0
En retard
0
Gratuit
6
Évaluation
Projets
6
50%
Arbitrage
0
En retard
0
Gratuit
7
Évaluation
Projets
426
38%
Arbitrage
86
44%
/
19%
En retard
71
17%
Chargé
8
Évaluation
Projets
40
10%
Arbitrage
0
En retard
0
Gratuit
9
Évaluation
Projets
4
0%
Arbitrage
2
0%
/
100%
En retard
1
25%
Gratuit
Commandes similaires
Description: I am in urgent need of a powerful and reliable MT5 Expert Advisor (EA) that can consistently pass any prop firm challenge account within 1-2 days. The trading strategy can be flexible, as my primary goal is to ensure a swift and successful account evaluation. If you have an existing EA or can develop one that meets these criteria, please contact me as soon as possible. Contact Information: Phone: +91
Description: I am in urgent need of a powerful and reliable MT5 Expert Advisor (EA) that can consistently pass any prop firm challenge account within 1-2 days. The trading strategy can be flexible, as my primary goal is to ensure a swift and successful account evaluation. If you have an existing EA or can develop one that meets these criteria, please contact me as soon as possible. Contact Information: Phone: +91
I have an existing Indicator that i want to add a license into, i have the source code also and i need it as fast as possible, there will be more projects like this to come if this is done well
The Moving Average ADX Indicator Expert Advisor For MT4. To work on all Timeframes. With this EA Both Moving Averages must be pointing in the same direction regardless of Buys or Sales. Logic For Buys Both moving averages must be pointing upwards, the fast and the slow. Coupled with the ADX Indicator to confirm the trend. The ADX indicator line must be above the 25 level and the +Di line must be above the -Di line to
Hi all. I have learned that due to my EA reading from chart objects, it cannot be optimised, and that is obviously problematic for optimisation and back testing parameters. So I have been met with 2 options it seems, have the EA rebuilt from scratch according to a slightly altered spec which doesn't rely on chart objects, or modify the existing EA As I don't want to put the EA source code out here for random people
Arbitrage EA
30 - 100 USD
To work on fast broker 14 ms as master and slow broker 80 ms slave. Be able to put ea on one chart and time frame on master and one on slave and to automatically monitor all major and minor pairs plus indices on mt4.money management settings and fixed lot. Master and slave setting for the different brokers. Just need to be able to load on chart and let it run with just money management settings to set. Hidden take
Mt4 indicator to EA
30+ USD
I'd like mt4 indicators to be converted into trading bot, these indicators produces buy and sell signal I want them to be automatic bot that also have circles of which I know what they and I'll explain what must the bot analyze
Nt8
30+ USD
i'm searching a way to define which IP address is using by NT8 cause i'm using a multiple IPs machine (for my daily job) and I'd need to have a further confirmation that I'm using the correct IP address with NT8 could anyone explain explain me how to do it for a fee
CRT bot
30 - 50 USD
I want a programmer to program an expert advisor that will follow CRT trading strategy. Which spoting previous candle high and low, then wait for the either of the level to be sweep without the candle closing below the level enter a position at the spot and target opposing liquidity
I need a developer with FxDreema experience to build an MT5 EA that: Manages recovery zones with pending buy/sell orders. Implements trailing stops, pre-defined profit lines, and dynamic lot sizing. Supports money management based on account balance and lot size and money value. Offers options for continuous or stop trading. The developer must provide the source code and FxDreema link . More specific details will be
Informations sur le projet
Budget
30+ USD
Pour le développeur
27
USD
Délais
de 1 à 2 jour(s)