Forex Zone - Forex Forum

Ea required on RSI

Discussion started on New EA Coding

  • Newbie
  • Posts: 47
  • Points: 214
  • Likes Received: 17
  • Reputation: +2/-0
I need a simple Ea that will buy when RSI =>50  and sell when RSI< 50, tp and sl should be set,  if loss it will martingale with a multiplier other wise continue to trade with "Normal" lot size as set in parameters,



Linkback: https://www.forex.zone/new-ea-coding/26/ea-required-on-rsi/4430/
#1 - November 27, 2023, 10:14:59 AM
« Last Edit: July 18, 2024, 10:08:22 PM by Admin »

Administrator
  • Hero Member
  • Posts: 4949
  • Points: 29028
  • Likes Received: 5060
  • Reputation: +220/-14
Should this EA be for MT4?
#2 - November 27, 2023, 02:52:08 PM
Ea required on RSI in New EA Coding_FEN-Indicator-728x90

  • Newbie
  • Posts: 47
  • Points: 214
  • Likes Received: 17
  • Reputation: +2/-0
Yes, EA for mt4
#3 - November 28, 2023, 12:52:00 PM

Administrator
  • Hero Member
  • Posts: 4949
  • Points: 29028
  • Likes Received: 5060
  • Reputation: +220/-14
buy when RSI =>50  and sell when RSI< 50
You mean the EA should have 1 trade open at a time, right? So let's say there is a buy open and then RSI goes below 50, the buy should close and then a sell should open. If so, you want to use closed RSI values, right? If not, you will get many trades opening and closing whenever RSI ranges around 50. For example, 49.9 to 50.1 and then 50.1 down to 49.8 and then 49.8 up to 50.2. And so on. If real-time RSI values are used then you will get many trades opening and closing in a short amount of time. Each time eating spreads or costing you commission.
#4 - November 28, 2023, 01:21:25 PM

  • Newbie
  • Posts: 47
  • Points: 214
  • Likes Received: 17
  • Reputation: +2/-0
Let me explain the strategy.

             RSI >=50,
            ea will buy with  fix take profit and stoploss as this will be input by the user. Now unless this trade is open no other trade will be opened.  case 1:  This trade hits take profit then another trade will be opened depending on the RSI value
                   Case 2;  This trade hits stoploss then another trade will be opened depending on the RSI value
                  So let us take the example of Gold, Gold is now 2046, RSI above 50 so a buy trade with lot size 0.01 (as input by user) will be opened take profit will be 2050, stoploss will be 2042, 4 pip tp and same sl, also note i want this ea specifically for gold
                Now if our trade hit tp then another buy trade will be opened at 2050 as RSI is in positive territory, take profit 2054, stop loss 2046 .
                  If our trade hit sl then another trade will be opened depending on the RSI Value with double lot size i.e. 0.02
                 If our 2nd trade again hit stoploss then 3rd trade will be opened depending on RSI value with double lot size i.e. 0.04
                 The ea will continue martingale unless a trade wins, then it will place trade with normal lot size i.e. 0.01
                  EA will input  how many times it will martingale. If it achieves profit it will stop working at a certain level
                 
                  I used this strategey manully on Gold and found good results. I hope it will work on EA also
#5 - November 29, 2023, 05:39:54 AM

Administrator
  • Hero Member
  • Posts: 4949
  • Points: 29028
  • Likes Received: 5060
  • Reputation: +220/-14
Attached is FZ RSI Martingale EA. See the notes below.


Gold is now 2046, RSI above 50 so a buy trade with lot size 0.01 (as input by user) will be opened take profit will be 2050, stoploss will be 2042, 4 pip tp and same sl
I noticed here that we are not on the same page about Pips, especially with Gold. Your example meant to me more like 40 pips or 400 pips (depending on broker). Definitely not 4 pips though. So the TakeProfit, StopLoss, and Slippage are all based in Points, not Pips. This is the recommended way to do it to ensure the EA will work on any broker and chart. No conversions are necessary.

To set this EA, simply think in terms of Points. For example, if Gold in your chart is 2045.25 then 1 Point up would be 2045.26. If your chart shows Gold as 2045.2 (a broker that offers less precision), then 1 Point up would be 2045.3.


EA will input  how many times it will martingale. If it achieves profit it will stop working at a certain level
A more simple EA was coded, which you mentioned in your first post. So it does not have these two options you mentioned later. If there are enough people interested in this EA, it could be modified later.


Other Notes:
  • In order for Martingale to work, the Multiplier setting must be greater than 0. Also, the EA specifically looks to see if an SL was hit since this is what you asked for. So let's say you close an order early in loss yourself, this is not an SL being hit. In this case, the EA will not use Martingale then. Martingale also will not be used if you don't set any SL at all too.
  • DLL must be enabled to use this EA. Except for back testing.
#6 - November 30, 2023, 02:38:21 AM
Attachments:

  • Newbie
  • Posts: 47
  • Points: 214
  • Likes Received: 17
  • Reputation: +2/-0

    Well, the ea is working fine, thanks for your cooperation, I just want to add one more thing,   if after one successful iteration means wining of 01 trade, either ea should stop or continue to trade, just add this option, thanks
#7 - July 11, 2024, 01:11:08 PM

Administrator
  • Hero Member
  • Posts: 4949
  • Points: 29028
  • Likes Received: 5060
  • Reputation: +220/-14
    Well, the ea is working fine, thanks for your cooperation, I just want to add one more thing,   if after one successful iteration means wining of 01 trade, either ea should stop or continue to trade, just add this option, thanks
I replied to your PM. I will look into this soon. It's been a while since the last time this EA was worked on. So I'll need to review it later when I have time.
#8 - July 11, 2024, 01:20:38 PM

Administrator
  • Hero Member
  • Posts: 4949
  • Points: 29028
  • Likes Received: 5060
  • Reputation: +220/-14
Here is the new version of FZ RSI Martingale EA.

There is a new true/false input added. If true, and TP is hit, the cycle is considered complete and you will need to re-initialize the EA. If false, it will continue trading as before non-stop.
#9 - July 12, 2024, 02:14:57 AM
Attachments:

Administrator
  • Hero Member
  • Posts: 4949
  • Points: 29028
  • Likes Received: 5060
  • Reputation: +220/-14
As requested by PM, attached is FZ RSI Martingale EA v1.20.

A new setting has been added called '# TP Trades Before Stopping'. It is used whenever 'Stop After TP?' is true.

If you set the new setting to 2 and there are 2 TP's obtained since last EA initialization then the EA will suspend trading. You will see a comment in the upper left corner of the chart telling you to restart the EA. Once you restart the EA, the cycle starts again. If you set it to 3 then once 3 TP's are obtained then the EA will suspend trading. And so on. It just takes whole numbers and is easy to use.

Notes:
  • This feature only considers TP's. It does not consider manually closed trades or trades that hit SL.
  • This new setting uses the last EA initialization time. Not the new day of the broker and not the new day in your local time. So you have to manually choose when to restart the EA and it starts again from that point.
  • The Take Profit trades do not necessarily have to be in a row. The EA will suspend trading whenever it sees the # of TP trades required since last initialization time.
#10 - August 04, 2024, 11:37:37 PM
Attachments:

  • Newbie
  • Posts: 47
  • Points: 214
  • Likes Received: 17
  • Reputation: +2/-0
Hi,I tried it to attach  this new ea ver 1.20  to a chart but it is not working, kindly check

                   thanks for your cooperaton
#11 - August 05, 2024, 03:19:46 AM

Global Moderator
  • Newbie
  • Posts: 39
  • Points: 2178
  • Likes Received: 16
  • Reputation: +3/-0
Hi,I tried it to attach  this new ea ver 1.20  to a chart but it is not working
It works for me. What are you seeing?
#12 - August 05, 2024, 04:06:01 AM

  • Newbie
  • Posts: 47
  • Points: 214
  • Likes Received: 17
  • Reputation: +2/-0
  I tried to attach this ea to 03 different metatrader 4 but it did not attached,
#13 - August 05, 2024, 04:38:49 AM

Administrator
  • Hero Member
  • Posts: 4949
  • Points: 29028
  • Likes Received: 5060
  • Reputation: +220/-14
  I tried to attach this ea to 03 different metatrader 4 but it did not attached,
It's weird. It works on my one MT4, but not the other. Both are the same builds too. I'll look into this soon.
#14 - August 05, 2024, 12:12:50 PM

Administrator
  • Hero Member
  • Posts: 4949
  • Points: 29028
  • Likes Received: 5060
  • Reputation: +220/-14
Attached is version 1.21

The code has been updated to newer standards. Even though the old code compiled fine with no warnings or errors. The MT4 has changed a little since last time.

The reason the previous EA worked on my one platform but not the other was because I had the mql4 source code in the one platform. It's weird that if you have the source code, it works fine. If you just have the EX4 it doesn't work, even though the MT4 converts the source code to the same EX4 before running and the EX4 compiled fine. So the MT4 refused to run the EX4 on the one terminal without the source code, but allowed it to run the same exact EX4 on another.

There will probably be many EAs out there that stop working over this change.
#15 - August 05, 2024, 01:06:01 PM
Attachments:

Members:

0 Members and 1 Guest are viewing this topic.