Convert ADX EA from MQL4 to MQL5 - 20 lines of code only

MQL5 Experts

Trabalho concluído

Tempo de execução 14 minutos

Termos de Referência

Convert this simple lines of MQL4 Code to a MQL5 Expert Advisor:

input int  TakeProfit=3900;//Take profit
input int  StopLoss=500;//Stop Loss

input int MAGIC = 2930;
input double defaultLot = 0.01;
input int period = 13;
input ENUM_APPLIED_PRICE appliedPrice = PRICE_CLOSE;
input int shift = 0;
input int limitUp = 40;

void OnTick()
  {   
   double adx_main = iADX(NULL, 0, period, appliedPrice, MODE_MAIN, shift);
   double adx_plusdi = iADX(NULL, 0, period, appliedPrice, MODE_PLUSDI, shift);
   double adx_minusdi = iADX(NULL, 0, period, appliedPrice, MODE_MINUSDI, shift);
   
   if(countOrders(MAGIC) == 0) {
      if(adx_main > limitUp) {
         double lot = defaultLot;
         if(adx_plusdi > adx_minusdi) {
            Print("Open SELL Lot:"+DoubleToStr(lot)+" - SL:"+IntegerToString(StopLoss)+" -TP:"+IntegerToString(TakeProfit));
            sell(lot, StopLoss, TakeProfit, MAGIC, "");
         } else if(adx_plusdi < adx_minusdi) {
            Print("Open BUY Lot:"+DoubleToStr(lot)+" - SL:"+IntegerToString(StopLoss)+" -TP:"+IntegerToString(TakeProfit));
            buy(lot, StopLoss, TakeProfit, MAGIC, "");
         }
      }
   }

}

Some functions are not included:

- "countOrders" will return the number of executed orders for this specific MAGIC number

- "sell"/"buy" will open a sell/buy order with the specified parameters

So basically, the EA will open an order if there no order already opened, and if:

- the ADX Plus DI is above the ADX Minus DI (sell)

- the ADX Plus DI is below the ADX Minus DI (buy)


Respondido

1
Desenvolvedor 1
Classificação
(414)
Projetos
478
40%
Arbitragem
7
43% / 29%
Expirado
16
3%
Livre
2
Desenvolvedor 2
Classificação
(229)
Projetos
339
49%
Arbitragem
21
5% / 33%
Expirado
24
7%
Livre
3
Desenvolvedor 3
Classificação
(2077)
Projetos
2636
61%
Arbitragem
113
45% / 26%
Expirado
418
16%
Trabalhando
4
Desenvolvedor 4
Classificação
(590)
Projetos
789
71%
Arbitragem
9
33% / 33%
Expirado
22
3%
Livre
5
Desenvolvedor 5
Classificação
(23)
Projetos
53
9%
Arbitragem
10
20% / 60%
Expirado
11
21%
Livre
6
Desenvolvedor 6
Classificação
(355)
Projetos
589
70%
Arbitragem
14
43% / 7%
Expirado
28
5%
Livre
7
Desenvolvedor 7
Classificação
(24)
Projetos
34
9%
Arbitragem
3
33% / 0%
Expirado
8
24%
Livre
8
Desenvolvedor 8
Classificação
(414)
Projetos
670
33%
Arbitragem
60
17% / 32%
Expirado
113
17%
Trabalhando
9
Desenvolvedor 9
Classificação
(53)
Projetos
79
18%
Arbitragem
13
15% / 54%
Expirado
5
6%
Livre
10
Desenvolvedor 10
Classificação
(320)
Projetos
521
66%
Arbitragem
52
21% / 38%
Expirado
165
32%
Trabalhando
11
Desenvolvedor 11
Classificação
(439)
Projetos
545
25%
Arbitragem
21
38% / 38%
Expirado
83
15%
Livre
12
Desenvolvedor 12
Classificação
(1127)
Projetos
1429
62%
Arbitragem
21
57% / 10%
Expirado
43
3%
Livre
13
Desenvolvedor 13
Classificação
(28)
Projetos
36
17%
Arbitragem
5
20% / 40%
Expirado
17
47%
Livre
14
Desenvolvedor 14
Classificação
(97)
Projetos
121
25%
Arbitragem
5
20% / 60%
Expirado
17
14%
Livre
15
Desenvolvedor 15
Classificação
(563)
Projetos
932
47%
Arbitragem
301
59% / 25%
Expirado
124
13%
Trabalhando
16
Desenvolvedor 16
Classificação
(4)
Projetos
5
0%
Arbitragem
3
0% / 67%
Expirado
2
40%
Livre
17
Desenvolvedor 17
Classificação
(62)
Projetos
140
46%
Arbitragem
19
42% / 16%
Expirado
32
23%
Livre
18
Desenvolvedor 18
Classificação
(46)
Projetos
73
16%
Arbitragem
13
8% / 92%
Expirado
37
51%
Livre
Pedidos semelhantes
The Expert Advisor would use two built-in indicators as entry/exit signals and our own risk management strategy with customizable inputs. The goal is to create a reliable and efficient trading tool that can automate our trading process on the MT5 platform
Hi, I have an indicator from my friend, I want to copy it to my own MT5 can you do that for me. Here is the link
I'm looking for someone to help me create an arbitrage trading robot that can trade on any decentralized exchange and forex market. I already have some source code to a strategy but would like to enhance it to make it profitable and automated
I installed the E.A. into the Experts folder in MT4. When I double click on it nothing happens. When I right click and "attach to chart" nothing happens. The E.A. is not grayed out, it simply will not attach. Any help would be greatly Appreciated
I have an EA and want to add few new logic to fetch profit taking factors and other values from an external master data and use it in existing EA
Hello Every one, Good day, I want from someone professional to create an EA is working on Mt5, This EA is working by depend on some indicators, and all those indicators must be working on MACD window, not on the chart, for more details please read my attached pdf file carefully. Many Thanks
I'm looking for an expert MQL5 developer that can create an EA that's based on my price action trading strategy with no indicators. The EA must analyze trades based on my price action rules, enter trades based on my price action rules, manage trades based on my price action rules and exit trades based on my price action rules
hi hi there i have an strategy on tradingview and i want to automate it like metatrader EA so i want the strategy to open and close trade automaticlly on tradingview
We are looking for an experienced Expert Advisor Developer who can build a customized MT5 Expert Advisor for us. The Expert Advisor would use two built-in indicators as entry/exit signals and our own risk management strategy with customizable inputs. The goal is to create a reliable and efficient trading tool that can automate our trading process on the MT5 platform. Skills required: - Strong understanding of
I need stochastic div (hidden &regular ea) that should perform task in all tf's ..divergence is a repaint stly so i want to use it with candlestick flips .. so bet for it

Informações sobre o projeto

Orçamento
30+ USD
IVA (20%): 6 USD
Total: 36 USD
Desenvolvedor
27 USD
Prazo
para 1 dias