Make EA based on EMA, RSI for MT5

Auftrag beendet

Ausführungszeit 19 Stunden

Spezifikation

### Explanation for Developing the Multi-Timeframe EA

**Objective:**
Create an Expert Advisor (EA) for MetaTrader 5 (MT5) that replicates the functionality of the Ultimate RSI indicator from TradingView. The EA will open and manage trades based on the crossover signals of the RSI and EMA within the same window, incorporating multi-timeframe analysis.

**Specifications:**
1. **Indicators Used:**
   - Relative Strength Index (RSI)
   - Exponential Moving Average (EMA)

2. **Trading Logic:**
   - Open a buy position when the RSI crosses the EMA from below.
   - Open a sell position when the RSI crosses the EMA from above.
   - Always have one trade open:
     - Close the current trade when an opposite signal is generated and open a new trade in the opposite direction.

3. **Multi-Timeframe Analysis:**
   - Use higher timeframe data for confirming signals.
   - For example, check RSI and EMA crossovers on the H1 timeframe for signals, but execute trades on the M15 timeframe.

4. **No Take Profit (TP) or Stop Loss (SL):**
   - The EA will not use traditional TP or SL levels. Instead, it will close and reverse positions based on the crossover signals.

### Step-by-Step Development Plan

1. **Initialization:**
   - Initialize the RSI and EMA indicators with the desired periods and timeframes.

2. **Indicator Calculation:**
   - In the `OnCalculate` function, calculate the RSI and EMA values for the current and higher timeframes.

3. **Crossover Detection:**
   - Identify when RSI crosses above or below the EMA on the higher timeframe.
   - Use these signals to make trading decisions on the current timeframe.

4. **Trade Execution:**
   - Implement logic to open, close, and reverse trades based on the detected signals.
   - Ensure only one trade is open at any time.

### Detailed Implementation Steps

1. **Indicator Initialization:**
   - Define the periods for RSI and EMA.
   - Define the timeframes for analysis (e.g., H1 for signals, M15 for execution).
   - Initialize buffers to store RSI and EMA values for both timeframes.

2. **Calculate Indicators:**
   - In the `OnCalculate` function, calculate the RSI and EMA for the higher timeframe.
   - Store these values in the respective buffers.

3. **Check for Crossover:**
   - Compare the RSI and EMA values for the current and previous bars on the higher timeframe to detect a crossover.

4. **Trade Logic:**
   - On a bullish crossover (RSI crossing above EMA):
     - Close any open sell position.
     - Open a buy position.
   - On a bearish crossover (RSI crossing below EMA):
     - Close any open buy position.
     - Open a sell position.

5. **Order Management:**
   - Ensure that only one trade is open at any time.
   - Handle errors and edge cases (e.g., if no trade is currently open).

### Pseudocode Outline


#include <Trade\Trade.mqh>


input double LotSize = 0.1;

input int RSIPeriod = 14;

input int EMAPeriod = 14;

input ENUM_TIMEFRAMES TimeFrame = PERIOD_M1;


CTrade trade;


//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

   static double previous_rsi = 0;

   static double previous_ema = 0;


   // Create handles for RSI and EMA

   int handle_rsi = iRSI(_Symbol, TimeFrame, RSIPeriod, PRICE_CLOSE);

   int handle_ema = iMA(_Symbol, TimeFrame, EMAPeriod, 0, MODE_EMA, PRICE_CLOSE);


   // Declare arrays to store indicator values

   double rsi[2];

   double ema[2];


   // Check if handles are valid

   if (handle_rsi < 0 || handle_ema < 0)

   {

      Print("Error creating indicator handles");

      return;

   }


   // Copy indicator values into arrays

   if (CopyBuffer(handle_rsi, 0, 0, 2, rsi) < 0 || CopyBuffer(handle_ema, 0, 0, 2, ema) < 0)

   {

      Print("Error copying indicator values");

      return;

   }


   // Log current RSI and EMA values for debugging

   double current_rsi = rsi[0];

   double current_ema = ema[0];

   Print("Current RSI: ", current_rsi);

   Print("Current EMA: ", current_ema);


   // Ensure previous values are set to current if they are not yet initialized

   if (previous_rsi == 0 && previous_ema == 0)

   {

      previous_rsi = current_rsi;

      previous_ema = current_ema;

      return;

   }


   // Check if there's an open position

   bool isPositionOpen = PositionSelect(_Symbol);


   // Entry criteria

   if (previous_rsi != 0 && previous_ema != 0)

   {

      // Close existing position and open the opposite trade

      if (previous_rsi > previous_ema && current_rsi < current_ema)

      {

         // Sell signal

         if (isPositionOpen && PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY)

         {

            trade.PositionClose(_Symbol);

         }

         trade.Sell(LotSize, _Symbol, 0, 0, 0, "Sell on RSI cross below EMA");

         Print("Sell on RSI cross below EMA");

      }

      else if (previous_rsi < previous_ema && current_rsi > current_ema)

      {

         // Buy signal

         if (isPositionOpen && PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL)

         {

            trade.PositionClose(_Symbol);

         }

         trade.Buy(LotSize, _Symbol, 0, 0, 0, "Buy on RSI cross above EMA");

         Print("Buy on RSI cross above EMA");

      }

   }


   // Update previous RSI and EMA values

   previous_rsi = current_rsi;

   previous_ema = current_ema;

  }

//+------------------------------------------------------------------+



Bewerbungen

1
Entwickler 1
Bewertung
(22)
Projekte
28
11%
Schlichtung
6
33% / 50%
Frist nicht eingehalten
4
14%
Arbeitet
2
Entwickler 2
Bewertung
(337)
Projekte
455
52%
Schlichtung
22
50% / 27%
Frist nicht eingehalten
5
1%
Beschäftigt
3
Entwickler 3
Bewertung
(49)
Projekte
62
40%
Schlichtung
1
0% / 100%
Frist nicht eingehalten
7
11%
Frei
4
Entwickler 4
Bewertung
(10)
Projekte
25
28%
Schlichtung
1
0% / 0%
Frist nicht eingehalten
1
4%
Beschäftigt
5
Entwickler 5
Bewertung
(1)
Projekte
3
0%
Schlichtung
0
Frist nicht eingehalten
0
Arbeitet
6
Entwickler 6
Bewertung
(41)
Projekte
88
14%
Schlichtung
30
30% / 53%
Frist nicht eingehalten
36
41%
Arbeitet
Ähnliche Aufträge
I need EA that works on MT5 to be able to do the following: - Can recognize Support/Resistance area - Can recognize VWAP direction. - Can recognize RSI. - Can recognize Double Top/bottom, Bullish/Bearish hammer candle, Bullish/bearish engulfing candle. - Ability to set Stoploss below/above support/resistance, but risk must be fixed at a certain price. - Stoploss
I want a program that will help calculate and enter the market on full margin for me. I just need to put in the price for entry, Stop loss and TP then it will calculate the lot sizes for entering the trade on full margin on Mt5
I am seeking a highly skilled and experienced developer to assist with an important project. I need a development of an automated trading bot for NinjaTrader, utilizing a 4 SMA (Simple Moving Average) crossing strategy, with additional custom diversions for trade entries. The bot needs to be based on a strategy involving the crossing of four different SMAs. The exact periods for these SMAs and the conditions for
So i have copier EA. The idea is the EA will triggered through manual OP by user via mobile or whatever platform. Let's say 0.01 lot to trigger it. After the EA takes master's position, the EA will be standby mode. If the master take more OP, the EA still not take the master's position (OP) until the user input manually once again via mobile for another 0.01 lot. Since this is a MT4 EA, Whenever user want to close
preciso de um robô com duas médias móveis, uma exponencial high e uma exponencial low. preciso também ter a opção de utilizar e todos os tempos gráficos e alterar os parâmetros das médias. entrada de compra será feita quando um candle de alta romper e fechar a cima da média high e fechará a posição quando um candle de baixa romper e fechar a baixo da média low. a venda será feita quando o candle de baixa romper e
Description - An expert advisor(s), placing sell trades in EUR/USD, based on the close price of the previous two candles, as shown in the figure below. The trades would be made in the 5 minute, 1 hour, and 1 day timeframes. In the 5 minute and 1 hour timeframes the market orders would be placed at the start of a new candle, at specific times EST. The order would be cancelled at the close of that candle, i.e after 5
Greetings, As the title suggests, I am trying to convert an indicator that calls itself via an iCustom call like this. iMAArray_Buffer[loop_1] = iCustom ( NULL , Selected_TF, MQLInfoString ( MQL_PROGRAM_NAME ), "calculate" , RPeriod, MType, MPeriod, 1 , shift); Full code will not be provided, only the position that needs fixing. I cannot get this working in MQL5 but the original code runs smoothly in MQL4. Please
Hi, I have an indicator from my friend, I want to copy it to my own Traidingview or MT5 can you do that for me. Here is the link
Hi, I have an indicator from my friend, I want to copy it to my own Traidingview or MT5 can you do that for me. Here is the link
Greetings great developer, I am in search of a highly skilled developer to assist with an exciting project. I need to convert two open-source TradingView indicators to NinjaTrader 8 and implement a usage restriction based on computer IDs. If you have experience with NinjaTrader 8 coding please let me know. I’d be happy to discuss the details further

Projektdetails

Budget
40+ USD
Für die Entwickler
36 USD
Ausführungsfristen
von 1 bis 4 Tag(e)