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%
空闲
发布者: 4 代码
3
开发者 3
等级
(251)
项目
400
54%
仲裁
9
67% / 22%
逾期
36
9%
空闲
发布者: 2 代码
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)
项目
74
50%
仲裁
5
0% / 60%
逾期
19
26%
空闲
相似订单
hello great developer I want to modify my NT8 indicator to change its arrow printing logic so that arrows appear on the first candled dot, not after the series. no repaint and no back painting. all in real time. This will help me get timely signals. Scope of work - Modify NT8 indicator logic to print arrows on the first candled dot. - Ensure arrow print matches 90%+ accuracy compared to the current functionality. -
Saya ingin dibuatkan Expert Advisor untuk MetaTrader 5 berbasis strategi EMA 50/200 + Breakout 20 candle dengan sistem risk percentage otomatis. EA harus memiliki fitur ATR stop loss, trailing stop, break even, max spread filter, dan daily loss limit. Dilarang menggunakan martingale, grid, atau averaging. Target RR minimal 1:2 dan drawdown di bawah 20%
I am building a professional-grade survival EA for USDJPY designed to: Repeatedly pass FTMO-style challenges Sustain long-term funded accounts Deploy safely across multiple prop accounts This is not a retail scalper. This is a controlled EMA pullback engine with strict risk governance and anti-correlation logic . All parameters must be configurable. Defaults must match exactly as listed. Core Strategy – EMA Pullback
I’m after someone to make me a forex ex for meta trader 5 it will be trading GBPUSD only but having to align with EURUSD and rules and entry’s based off weekly and daily vwap with 20 EMA
Key Requirements: ​ Zone Detection: The EA must read "Weak Support/Resistance" zones generated by my indicator (I will provide the .mq4/ex4 file). ​ Execution Logic: - Identify the candle with the longest wick within the detected liquidity zone. ​Place a Pending Order (Buy Stop/Sell Stop) 20 points (2 pips) before the breakout level of that wick. ​ Trade Management: ​Fixed SL: 40 points (4 pips). ​Fixed TP: 40 points
I have a open source Tradingview indicator that I want it to be converted to Ninja Trader8. I have attached it. Please let me know, if you can do it and for how muc
hello great developer I'm looking to build a custom signal bot for Pocket Options using my specific trading strategy. Scope of work - Develop a signal bot for Pocket Options - Integrate my trading strategy into the bot - Ensure bot compatibility with Pocket Options platform Additional information I have a specific trading strategy that the bot needs to follow. Trading platform Custom Platform: Pocket Options Pairs
hello great developer I am looking for an experienced developer who already has a ready-made, high-quality trading bot available for testing The bot should be fully automated, stable, and optimized for MetaTrader 4 or MetaTrader 5. I want to test real performance through backtesting and forward testing before any final agreement
hello great developer I need to copy trading signals from the Forex Precision app. I receive push notifications with the trades, and I must manually copy them into MetaTrader 4 (MT4), including the entry price, take profit, and stop loss. Is necessary Copy from Forex precision take the type AUD/JPY Copy the entry value and type sell or buy and put this info in mt4 and put the take profitt +10 and stop loss -10
I need help in modifying an amibroker AFL indicator the indicator already works but I need per symbol static variable isolation, parameters persistence per symbol after restart, non declining trailing stop logic, parameter auto restore when switching symbols and a global reset function for static variables. For better understanding As discussed, this is the official offer for restructuring my RAD Chandelier stop loss

项目信息

预算
50+ USD