Fix an EA that isn't performing in the Strategy Tester

Job finished

Execution time 3 days
Feedback from employee
Good description of requirements specifications. Fast communication. Looking forward to working with you again

Specification

The specifications:

This EA uses the RSI exclusively for trade opens and closes.  The RSI crosses 50 moving upward and alerts the EA to watch.  When it reaches 53 it triggers a buy order.  When the RSI reaches 70, it triggers a close order.  Conversely, when the RSI crosses 50 moving downward, it alerts the EA.  When it reaches 47 it triggers a sell order.  This order is closed at RSI 30.  There is also a contingency if the RSI crosses over the 50 moving the opposite direction that the trade would close.  

As much is in the existing code.

Currently, the EA will only open and close one trade in the Strategy Tester.  I would like you to modify the EA to operate according to these specifications.  

I would also like you to add a trailing stop that can be adjusted.


Here is the existing code:



// Global Variables

enum StateType {WATCHING, LONG_ENTRY, SHORT_ENTRY, CLOSE_TRADE};

StateType state = WATCHING;

double LotSize = 0.1;  // Lot size

double StopLoss = 20.0 * Point;  // Stop loss in price difference

double TakeProfit = 100.0 * Point;  // Take profit in price difference

int slippage = 3;

int RSI_Period = 14;


// OnTick function

void OnTick() {

    double currentRSI = iRSI(Symbol(), 0, RSI_Period, PRICE_CLOSE, 0);

    double previousRSI = iRSI(Symbol(), 0, RSI_Period, PRICE_CLOSE, 1);


    if (state == WATCHING) {

        if (currentRSI > 50 && previousRSI <= 50) {

            state = LONG_ENTRY;

        } else if (currentRSI < 50 && previousRSI >= 50) {

            state = SHORT_ENTRY;

        }

    }


    if (state == LONG_ENTRY && currentRSI >= 53) {

        PlaceLongOrder();

    } else if (state == SHORT_ENTRY && currentRSI <= 47) {

        PlaceShortOrder();

    }


    if (state == CLOSE_TRADE) {

        CloseTrade(currentRSI);

    }

}


// Function to place a long order

void PlaceLongOrder() {

    if (OrdersTotal() == 0) {

        double price = Ask;

        int ticket = OrderSend(Symbol(), OP_BUY, LotSize, price, slippage, price - StopLoss, price + TakeProfit, "Buy Order", 0, 0, clrGreen);

        if (ticket > 0) state = CLOSE_TRADE;

    }

}


// Function to place a short order

void PlaceShortOrder() {

    if (OrdersTotal() == 0) {

        double price = Bid;

        int ticket = OrderSend(Symbol(), OP_SELL, LotSize, price, slippage, price + StopLoss, price - TakeProfit, "Sell Order", 0, 0, clrRed);

        if (ticket > 0) state = CLOSE_TRADE;

    }

}


// Function to close the trade based on RSI

void CloseTrade(double currentRSI) {

    for (int i = 0; i < OrdersTotal(); i++) {

        if (OrderSelect(i, SELECT_BY_POS) && OrderSymbol() == Symbol()) {

            if ((OrderType() == OP_BUY && currentRSI >= 70) || (OrderType() == OP_SELL && currentRSI <= 30)) {

                bool closed = OrderClose(OrderTicket(), OrderLots(), (OrderType() == OP_BUY ? Bid : Ask), 3, clrRed);

                if (closed) state = WATCHING;

            } else if ((OrderType() == OP_BUY && currentRSI < 50) || (OrderType() == OP_SELL && currentRSI > 50)) {

                closed = OrderClose(OrderTicket(), OrderLots(), (OrderType() == OP_BUY ? Bid : Ask), 3, clrRed);

                if (closed) state = WATCHING;

            }

        }

    }

}

    



Responded

1
Developer 1
Rating
(250)
Projects
313
28%
Arbitration
33
27% / 64%
Overdue
10
3%
Working
2
Developer 2
Rating
(37)
Projects
59
27%
Arbitration
26
19% / 54%
Overdue
10
17%
Working
Published: 1 code
3
Developer 3
Rating
(2642)
Projects
3357
68%
Arbitration
77
48% / 14%
Overdue
342
10%
Free
Published: 1 code
4
Developer 4
Rating
(16)
Projects
35
23%
Arbitration
4
0% / 50%
Overdue
2
6%
Working
5
Developer 5
Rating
(14)
Projects
18
67%
Arbitration
2
50% / 50%
Overdue
3
17%
Free
6
Developer 6
Rating
(2309)
Projects
2905
63%
Arbitration
122
44% / 25%
Overdue
429
15%
Working
7
Developer 7
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
8
Developer 8
Rating
Projects
0
0%
Arbitration
2
0% / 100%
Overdue
0
Free
9
Developer 9
Rating
(43)
Projects
66
12%
Arbitration
12
58% / 42%
Overdue
1
2%
Free
10
Developer 10
Rating
(48)
Projects
49
8%
Arbitration
0
Overdue
0
Free
Similar orders
I need an mql5 EA which can be used with 100$ capital very low drawdown The EA should be high frequency trading special for XAUUSD and btcusd or binary options but also the EA should be testable via strategy tester and demo test for five days is needed NO SELECTION CAN BE DONE WITHOUT TESTING when applying make sure you send the backtester results with demo EA testable via strategy tester
I currently have a powerful and well-structured Expert Advisor available on the MT5 platform. This EA is designed with: ✅ Advanced entry and exit logic ✅ Smart risk management system ✅ Automatic lot sizing option ✅ Break-even and trailing stop protection ✅ Spread and session filters ✅ Drawdown control features ✅ Optimized for XAUUSD and scalping strategies ✅ Suitable for prop firm challenges like FTMO It is built for
Do you need a profitable and well-structured trading strategy converted into a fully automated Expert Advisor on the MT5 platform? I specialize in developing advanced, high-performance EAs with: ✅ Smart entry & exit logic ✅ Risk-based lot size calculation ✅ Break-even & trailing stop system ✅ Spread & session filters ✅ Daily drawdown protection ✅ Prop firm (FTMO-style) risk compliance ✅ Fully automated trade
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

Project information

Budget
50+ USD
Deadline
from 1 to 5 day(s)