Modification to persistent levels EA to make it more efficient and less management intensive

MQL4 Эксперты

Техническое задание

The goal here is to get trades opened at or near support and resistance levels and allow the user to manually trail until the market takes out the trade. Use of take profit will be rare and only in sideways markets. I have something similar but this has enough changes in the logic to justify building a whole new EA with code the programmer is familiar with. All we would be able to keep is the Magic number and some of the trigger coding which is not so difficult to put together again.

 User can draw horizontal lines on MT4 chart with EA and EA will incorporate those lines as trade levels. Additionally i would like to add an offset variable so that the trades do not happen on each line but a user defined distance from each line. There still needs to be a trigger distance to determine the market is moving in the desired direction with enough momentum to justify the trade. Essentially this is grid strategy but the levels reactivate them selves based on user drawn lines.


Proposed Logic:
M = Magic #
SL=Stop loss
BE=Break even trigger
BEP=Break even (pips)
IS=initial stop loss
ED=trigger distance
ER=Extra risk management
P@=price at tick (current price)
BP=buy price
SP=sell price
HLA=Horizontal line above current price
HLB=Horizontal line below current price
IT=Incremental trail
OS:Offset

New trade logic
if HLA-ED-OS>P@ then buy at HLA=yes 
Buy at HLA=yes/no (once this changes to yes it will stay yes until the level is triggered or the EA is removed from the chart)
if HLB+ED+OS<P@ then sell at HLB-=yes
Sell at HLB=yes/no (once this changes to yes it will stay yes until the level is triggered or the EA is removed from the chart)
if ER=no then ER=0 always
if ER=yes then check for open trades when level is reached Only place a new trade if all buy stop losses > buy price AND all sell stop losses < sell price result =ER
if ER>0 no trades can be placed

if P@=HLA +OS (+/- Slippage) AND buy at HLA=yes AND ER=0 place buy trade

if P@=HLB -OS (+/- Slippage) AND sell at HLB=yes AND ER=0 place sell trade

Open trade management logic
if P@>BP+BE AND SL<BP+IS move stop loss to BEP
if P@<SP-BE AND SL>BP-IS move stop loss to BEP
if IT=yes any time a stop loss is moved all trades with same M will have the same stop loss.

Trade Preperation Logic:
Lot size = equity*risk%/initial hedge
stop loss = entry price +/- initial stop loss
take profit = Take prfit if >0


user set variables:

MAGIC NUMBER: so that the same EA can be run on multiple pairs

RISK %: The lot size should be calculated using Equity *(risk%*.01)/initial hedge. In the example if its a $2500.00 account with no open trades it would be 2500*.02= 50/25=2*0.1= 0.2 lot size. This will allow the value to change at the time of trade according to current equity. It will be important when trading multiple pairs.

EXTRA RISK MANAGEMENT (Yes/No):If no this sequence is skipped. If yes Before a new trade is placed it needs to check all open trades regardless of magic number and verify that buy trades have stop losses > entry and sell trades have stop losses < entry. Only 1 open trade should ever be at risk. if there is already an open trade that has not moved to break even or better then no new trade should be placed. This functions independant of Incrimental trail as all trades move to break even when trigger is reached.

TRIGGER DISTANCE: distance from line where the trade becomes active. While i do not want to use pending orders i do want the EA to act as though they are pending orders set when the level is further away than the LEVEL TRIGGER DISTANCE. For examle if there is a resistance level at 1.11250 and the trigger distance is set to 25 pips then if the market is already at 1.11010 and moving up the trade will never take place but if the market falls below 1.11000 then moves back up the level will be active and a trade will be taken at 1.11250. If it were a pending trade the trade would be created any time the market falls below 1.11000. 

BREAK EVEN TRIGGER (pips): a # in pips at which point the stop loss will be moved to break even. This needs to be persistant so if the user accidently moves a break even to a losing position it will move back. however the logic sould dictate that it will not move any stop loss moved to a more proffitable position than the initial break even.

SLIPPAGE (pips): # in pips in case the market is really moving at the time the trade is taken.

BREAK EVEN (pips): a # in pips to define what break even is.

INITAL STOP LOSS (pips): a # in pips to determine how far from the trade the initial stop loss is placed

OFFSET: a # in pips away from the level at which a trade would be taken. This makes space for peak overs. example if this is set to 10 and there is a level at 1.25000 then the buy would be activated at or below 1.24750 and the buy would be entered at 1.25100. All other variables are based on actual entry level of the trade so they would enter based on the 1.25100 price for a buy.

TAKE PROFIT (optional): there may be times when i want to set a take profit for each trade this is where it would be done. 0= let it run without take profit. but it could be set at any # in pips.

INCREMENTAL TRAIL (Yes/NO): This is a yes or no option. If it is yes then any stop loss that is moved by the EA will move stops for all open trades with the same MAGIC NUMBER to the newest position.



Detailed example : Using real data from gbpjpy 4 hours candles assuming 25 pips for all triggers as well as initial stop loss and 3 pips for break even.4-5-18 to 4-18-18 levels at 150.389, 152.001, 153.460. Market opens at 150.350 this is near a line but too close so no HL+=no there is not trade at 150.350 the line may as well not exist.The market moved down over the next 4 hours to 28 pips, when it crosses 25 below the level them HL+=YES  a buy trade at 150.350 will be taken the next time the price touches it. 8 hours later it crosses that level and a BUY market order is placed with a stop loss set 25 pips down.  At this point as HL+ = 152.001 and YES and 150.350 is HL-=NO.During the next 4 hours the market draws down but not to 25 pips so the trade is still active. About 6 hours after the trade is taken the trade reaches 25 pips profitable and the stop loss is moved to 3 pips (break even) and HL-=yes@ 150.389. Over the next 2 days the market continually moves up and down but not quite low enough to stop out the trade. The user may have caused a stop out by manually trailing but for this example assume the trade is still active on 4-10-18 when between midnight at 3am the market crosses the 152.001 level which has been HL+=yes since the prevous trade stop loss was moved to 3 pips profitable and so a new buy trade is triggered. This buy trade triggers and since Incremental Trail is on both trades set their stop losses at 151.751 and during the next 4 hours both trades stop out one losing 25 pips and the other in profit 135 pips. 8 hours later the market has moved down 30 pips causing HL+=YES again at the same level and then moved back up triggering another buy. This time it goes up just enough to move to break even as well as activating the same level as a sell and then it goes back down and closes the buy trade and triggering the sell. on 4-12-18 the market goes back up closing the sell trade at break even assuming again that the user did not manually trail to get some profit out of the downard move. The buy is triggered again. This time over 24 hours it moves up to trigger the next level crossing it and then coming back down after going 40 pips past the entry and triggering the move to break even moving both stop losses first to the 25 pips below and then to 3 pips in profit for the most recent trade. The market then comes back 4 hours later and stops out both trades. This also triggers the sell trade that was activated when the buy trade moved 25 pips profitable. The market then moves down 70 pips activating the sell and moving the stop to break even. This is where the example ends but i'm sure you get the picture.


Откликнулись

1
Разработчик 1
Оценка
(33)
Проекты
35
40%
Арбитраж
11
9% / 91%
Просрочено
4
11%
Свободен
3
Разработчик 3
Оценка
(251)
Проекты
400
54%
Арбитраж
9
67% / 22%
Просрочено
36
9%
Свободен
4
Разработчик 4
Оценка
(84)
Проекты
149
31%
Арбитраж
32
34% / 41%
Просрочено
43
29%
Свободен
5
Разработчик 5
Оценка
(66)
Проекты
95
28%
Арбитраж
20
25% / 55%
Просрочено
24
25%
Свободен
6
Разработчик 6
Оценка
(16)
Проекты
21
19%
Арбитраж
7
0% / 71%
Просрочено
14
67%
Свободен
7
Разработчик 7
Оценка
(43)
Проекты
72
49%
Арбитраж
4
0% / 50%
Просрочено
19
26%
Свободен
Похожие заказы
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
Hello, I have an indicator from a friend and I'd like to replicate it on my own TradingView or MT5 platform. Could you assist me with that?. Here is the link
so basically I have an EA(mql5), AI script(python), flask server and socket server both on python. Now this is an experimental script as I am trying to learn. However the EA is not entering any trades. How much would it cost for you to troubleshoot this for me? Thank you in advance
NEW FUNCTION 50+ USD
La idea es la siguiente, sería un EA semi automático. Yo como trader opero en zonas. En adelante las vamos a denominar ``zonas calientes´´. El EA debe que necesito debe operar conforme a 4 zonas calientes que yo configure en el mismo. ¿Qué hará el EA en cada una de esas zonas calientes que yo he configurado? En cada una de estas zonas el EA debe realizar hedging (crear un rango en el cual el EA entrara en sell o en
I have the bot just over half made, from another developer who let me down and decided they no longer wished to finish the project, so I have a basic example of the fundamentals of what it could look like, although multiple functions I require do not work, but I can show this to you on request. There are multiple features that I require, so please read the in depth requirement sheet on the attachment. Function: To
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 need an expert advisor (EA) based on stochastic divergence and candlestick formation. It should be able to identify both hidden and regular divergences. The EA should also include modified risk-reward ratios, modified timeframes, and a trailing stop loss. It is important that the EA is 100% accurate. Once an experienced developer applies, I will share the complete strategy."
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
I need someone that can make expert advisor for backtesting purpose. The input file is History trade report export file from MQl5 the expert advisor should open position the exact time of open trade on the report. The same as the close time

Информация о проекте

Бюджет
50+ USD
Исполнителю
45 USD