Enivid

Administrator
Staff member
Nov 30, 2008
19,222
1,506
144
Odesa
www.earnforex.com
I've had a look at the code for V1.03 and all I can see are these lines on 393 & 394 regarding SL generated values. How could I edit those?
By any chance could you do a quick "SL" function within the EA, like you have for TP, as it looks like the TP code lines on 395 and 396, have a TP function coded, for value entry?

Cheers

PHIL.

View attachment 22963
For buy orders, on line 393, change recent_high + spread to recent_high + spread + 10 * Poin - 999 * Poin, where 999 is your desired SL.
For sell orders, on line 394, change recent_low to recent_low - 10 * Poin + 999 * Poin, where 999 is your desired SL.
 

Luigi

Trader
Feb 20, 2023
7
0
12
34
Hi Enivid,
Is it possible to make the desired SL and TP to an ATR based value??
I know the Newstrader has ATR based but works on marketorders.
And Amazing wordks on pending stopordes
Thanks in advance
 

SilverWolf

Trader
Mar 11, 2023
3
0
6
45
Not sure. I've never tried it on Futures. Where are you trying to use it and with which futures?
sp500 mini with Amp Futures broker on MT5. Im kinda new to MT5.. Years ago I paper traded forex on MT4 but I like futures much better. Ive been with TOS and am exploring something else for MT5 EA ability.
 
May 10, 2023
21
0
17
53
Absolutely first class. Really impressed.
I have tried trading gold but the entry, SL and TP are vert close together. What code could I amend to widen the TP and SL?
Thank you Enivid.
 

Enivid

Administrator
Staff member
Nov 30, 2008
19,222
1,506
144
Odesa
www.earnforex.com
Absolutely first class. Really impressed.
I have tried trading gold but the entry, SL and TP are vert close together. What code could I amend to widen the TP and SL?
Thank you Enivid.
For entry and SL, you can try increasing CTCBN, so it will use more candles to calculate Min/Max, or you can modify the +10 pis and -10 pips values in the code to make the distance wider.
For TP, you control it directly via input parameters (TP).
 
May 10, 2023
21
0
17
53
For entry and SL, you can try increasing CTCBN, so it will use more candles to calculate Min/Max, or you can modify the +10 pis and -10 pips values in the code to make the distance wider.
For TP, you control it directly via input parameters (TP).
Excellent!! Thank you for this. I will play around with the code. Great EA.
Should I change the pip values from +10 to +100 and -10 to -100?
Oh, I will just play with the code. Best way to learn.
Thanks again!! :)
 
May 10, 2023
21
0
17
53
For entry and SL, you can try increasing CTCBN, so it will use more candles to calculate Min/Max, or you can modify the +10 pis and -10 pips values in the code to make the distance wider.
For TP, you control it directly via input parameters (TP).
Apologies, I am using MQ4 by the way. So, the code may differ? Can you confirm what line the code is at and I will make the required changes.
Thanks for all your help Enivid!
 

Enivid

Administrator
Staff member
Nov 30, 2008
19,222
1,506
144
Odesa
www.earnforex.com
Apologies, I am using MQ4 by the way. So, the code may differ? Can you confirm what line the code is at and I will make the required changes.
Thanks for all your help Enivid!
Look for these lines:
MQL4:
   buy_stop_entry = NormalizeDouble(recent_high + spread + 10 * Poin, _Digits);
    sell_stop_entry = NormalizeDouble(recent_low - 10 * Poin, _Digits);
 
May 10, 2023
21
0
17
53
Look for these lines:
MQL4:
   buy_stop_entry = NormalizeDouble(recent_high + spread + 10 * Poin, _Digits);
    sell_stop_entry = NormalizeDouble(recent_low - 10 * Poin, _Digits);
Many thanks Enivid!
I will use this. I have just been moaned at by my prop firm for spamming the server. I think I left the pending orders on for too long whilst getting used to the EA. They threatened to close my account. I will amend my pending account time down to 15 or 30 seconds per trade. I had the pending orders open for a long time so I guess this was the root cause.
Love the EA though.
 

Enivid

Administrator
Staff member
Nov 30, 2008
19,222
1,506
144
Odesa
www.earnforex.com
Many thanks Enivid!
I will use this. I have just been moaned at by my prop firm for spamming the server. I think I left the pending orders on for too long whilst getting used to the EA. They threatened to close my account. I will amend my pending account time down to 15 or 30 seconds per trade. I had the pending orders open for a long time so I guess this was the root cause.
Love the EA though.
You may also want to set the SecBMO parameter to a higher value to prevent order modification closer to the news.
 
May 10, 2023
21
0
17
53
Hi Enivid!!
I hope you are well!
Quick one if that is okay? On the MQ5 Amazing code, which line is the pending SL at please? I just want to amend my SL on some of the trades as there is quite a wick on some candles and I just want to play it safe with those wicks!!
Thank you for all your help! :)
 

Enivid

Administrator
Staff member
Nov 30, 2008
19,222
1,506
144
Odesa
www.earnforex.com
Hi Enivid!!
I hope you are well!
Quick one if that is okay? On the MQ5 Amazing code, which line is the pending SL at please? I just want to amend my SL on some of the trades as there is quite a wick on some candles and I just want to play it safe with those wicks!!
Thank you for all your help! :)
These lines:
MQL5:
    buy_stop_loss = NormalizeDouble(recent_high + spread, _Digits);
    sell_stop_loss = NormalizeDouble(recent_low, _Digits);
 
May 10, 2023
21
0
17
53
For buy orders, on line 393, change recent_high + spread to recent_high + spread + 10 * Poin - 999 * Poin, where 999 is your desired SL.
For sell orders, on line 394, change recent_low to recent_low - 10 * Poin + 999 * Poin, where 999 is your desired SL.
Hi Enivid.
Is this code for the MQ5 Expert? If so, what would the code be on MQ4?
I have tried to amend the SL code on the MQ4 but it does not seem to be working unfortunately.
Also, those lines of code are on lines 348 and 349.
Thank you!!
 
Last edited: