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

MQL5 Experts

Tâche terminée

Temps d'exécution 14 minutes

Spécifications

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)


Répondu

1
Développeur 1
Évaluation
(414)
Projets
478
40%
Arbitrage
7
43% / 29%
En retard
16
3%
Gratuit
2
Développeur 2
Évaluation
(229)
Projets
339
49%
Arbitrage
21
5% / 33%
En retard
24
7%
Gratuit
3
Développeur 3
Évaluation
(2077)
Projets
2636
61%
Arbitrage
113
45% / 26%
En retard
418
16%
Travail
4
Développeur 4
Évaluation
(590)
Projets
789
71%
Arbitrage
9
33% / 33%
En retard
22
3%
Gratuit
5
Développeur 5
Évaluation
(23)
Projets
53
9%
Arbitrage
10
20% / 60%
En retard
11
21%
Gratuit
6
Développeur 6
Évaluation
(355)
Projets
589
70%
Arbitrage
14
43% / 7%
En retard
28
5%
Gratuit
7
Développeur 7
Évaluation
(24)
Projets
34
9%
Arbitrage
3
33% / 0%
En retard
8
24%
Gratuit
8
Développeur 8
Évaluation
(414)
Projets
670
33%
Arbitrage
60
17% / 32%
En retard
113
17%
Travail
9
Développeur 9
Évaluation
(53)
Projets
79
18%
Arbitrage
13
15% / 54%
En retard
5
6%
Gratuit
10
Développeur 10
Évaluation
(320)
Projets
521
66%
Arbitrage
52
21% / 38%
En retard
165
32%
Travail
11
Développeur 11
Évaluation
(439)
Projets
545
25%
Arbitrage
21
38% / 38%
En retard
83
15%
Gratuit
12
Développeur 12
Évaluation
(1127)
Projets
1429
62%
Arbitrage
21
57% / 10%
En retard
43
3%
Gratuit
13
Développeur 13
Évaluation
(28)
Projets
36
17%
Arbitrage
5
20% / 40%
En retard
17
47%
Gratuit
14
Développeur 14
Évaluation
(97)
Projets
121
25%
Arbitrage
5
20% / 60%
En retard
17
14%
Gratuit
15
Développeur 15
Évaluation
(563)
Projets
932
47%
Arbitrage
301
59% / 25%
En retard
124
13%
Travail
16
Développeur 16
Évaluation
(4)
Projets
5
0%
Arbitrage
3
0% / 67%
En retard
2
40%
Gratuit
17
Développeur 17
Évaluation
(62)
Projets
140
46%
Arbitrage
19
42% / 16%
En retard
32
23%
Gratuit
18
Développeur 18
Évaluation
(46)
Projets
73
16%
Arbitrage
13
8% / 92%
En retard
37
51%
Gratuit
Commandes similaires
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

Informations sur le projet

Budget
30+ USD
TVA (20%): 6 USD
Total: 36 USD
Pour le développeur
27 USD
Délais
à 1 jour(s)