Make EA based on EMA, RSI for MT5

작업 종료됨

실행 시간 19 시간

명시

### 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;

  }

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



응답함

1
개발자 1
등급
(60)
프로젝트
87
29%
중재
24
13% / 58%
기한 초과
7
8%
작업중
2
개발자 2
등급
(429)
프로젝트
628
54%
중재
30
53% / 23%
기한 초과
6
1%
로드됨
3
개발자 3
등급
(52)
프로젝트
66
41%
중재
1
0% / 100%
기한 초과
7
11%
무료
4
개발자 4
등급
(16)
프로젝트
35
23%
중재
4
0% / 50%
기한 초과
2
6%
작업중
5
개발자 5
등급
(2)
프로젝트
5
0%
중재
3
0% / 100%
기한 초과
1
20%
작업중
6
개발자 6
등급
(45)
프로젝트
91
13%
중재
34
26% / 59%
기한 초과
37
41%
무료
비슷한 주문
Hello, I'm looking to find out the cost of creating a mobile trading robot. I've tried to describe it as thoroughly as possible in the following document. I look forward to your response. I'd like to know the costs, delivery time, and how you plan to implement it before making a decision
I have an existing MT5 Expert Advisor (“E-Core”). I need an experienced MQL5 developer to integrate a structured risk management upgrade and a higher timeframe trend filter into the current code. Two files will be provided: 1️⃣ E-Core Source Code (Current Version) 2️⃣ Update Instructions File (contains exact inputs, functions, and logic to integrate) The developer must: Integrate the update logic
DO NOT RESPOND TO WORK WITH ANY AI. ( I CAN ALSO DO THAT ) NEED REAL DEVELOPING SKILL Hedge Add-On Rules for Existing EA Core Idea SL becomes hypothetical (virtual) for the initial basket and for the hedge basket . When price hits the virtual SL level , EA does not close the losing trades. Instead, EA opens one hedge basket in the opposite direction. Original basket direction Hedge basket direction (opposite) Inputs
Billionflow 30 - 100 USD
Trading specifications: Indicators: Bollinger band ( Period 40, Deviation 1 apply to close) Moving Average (Exponential ) Period 17 applied to high Moving Average ( Exponential ) Period 17 applied to low But Signal enter a buy trade when prices crosses the lower band of the bollinger band up and also crosses the moving average channel of high and low the reverse is true for sell signal
Hello, I am a user of the "BUY STOP SELL STOP V6" trading bot, which is an advanced Grid System bot. The bot is primarily designed for Gold (XAUUSD), but I want it to work on all currency pairs. "The bot contains a privacy/protection code that prevents it from running on other accounts or being modified on any platform, as it has a client account number lock mechanism" --- Bot Description & Current Settings Bot Type
I am looking for a highly experienced Pine Script v5 developer to build a professional, non repaint price action indicator for TradingView. or a ready made one so i can purchase. This is a structured two phase project. The goal is to create a clean, intelligent price action tool that works for both fast intraday trading and swing trading. Only apply if you have strong Pine experience and understand liquidity
Hello, I’m looking for an experienced MQL4/MQL5 developer to work with me on an ongoing basis. My clients request services such as: Converting TradingView Pine Script indicators/strategies into MT4 or MT5 Expert Advisors Converting MT4 EAs to MT5 (and MT5 to MT4) Compiling and fixing existing MQL4 / MQL5 EA code Adding simple features like alerts, SL/TP, lot size, and basic money management This job is for
I am looking someone to create an EA based on my MACD Histo indicator / strategy from Pinescript. I will send it to you for you to replicate. The EA shall have: - Divergence length in bars, min and max values. - Pivot Logic - Entry on close of divergence confirmation bar. - Dynamic lot size dependent on SL/TP, in monetary value. - SL / TP in percent away from entry, separate values for long and short. - Time, day and
Hello, I have a breakout EA with reversal logic. I own the full source code for both MT4 and MT5 versions. I need the modifications implemented for both MT4 and MT5 versions. I need several modifications: – Multiple reversals with configurable parameters – Breakeven functionality – Entry only after candle close beyond range + offset – Time-based activation – Alternative offset calculation logic – Automatic close at
simple automated trading system with adaptive risk management and trend-based execution. The EA manages trades with dynamic position handling and built-in stability filters. Designed for single-position trading and disciplined execution 30 usd budget

프로젝트 정보

예산
40+ USD
기한
에서 1  4 일