How to use break even block?
-
I only started creating EA's this week but can clearly see the huge benefit (for my models at least) of the break even command. Problem is I am not sure how to connect it properly in the flow diagram, I want to program (visually,i have no programming skill):
A SL of 50 pips
A TP of 100 pips
And a Break even of 50 pipsThat is to say once it breaks 50 pips of profit I don't want it to fall back below 50 pips but can continue to reach 100 pips if the market conditions are in such a way favorable.
Your help will be greatly appreciated and my models should finally start making a profit consistently (still in back-testing phase at the moment)
-
The ** block is not used to lock profit, it is used to set minimum profit/loss in a trade to 0 (even).
To do what you wish you can use the [FOR EACH TRADE] blocks, like this: https://fxdreema.com/shared/Rn95fUYbe
-
__The ** block is not used to lock profit, it is used to set minimum profit/loss in a trade to 0 (even).
To do what you wish you can use the [FOR EACH TRADE] blocks, like this: https://fxdreema.com/shared/Rn95fUYbe[/quote:22kerz1k]
Thank you, I will try that now I have been struggling all day with it
-
Well, in some sence BE locks the profit. What it does is to put SL somewhere once. Similar to Trailing stop, but it changes SL once. Because there is a setting to put SL at some distance from the Open Price (BEP offset mode), I think you can put SL at 50pips (from the open price) once when the trade is on profit bugger than 50pips. Just make sure that the offset value is smaller than the profit value.
-
Thank you for your help everyone, that has helped me massively. After incorporating Uchias blocks into my program I back tested the following:
GBP/USD 1 year historic tick level data
EUR/USD 1 year historic tick level data
JPY/USD 1 year historic tick level dataGBP/USD 9 years historic tick level data
My WORST results were 75% wins, ending in 94% profit after 9 years. The others made ~28% in a year with 90-100% profitable trades each except for the JPY/USD which made no trades. The results are without leverage because i don't know how to incorporate that to my back tests.
I did however at one point have 15 consecutive losses amounting to a loss of £486, on a ten times leverage account that is dangerously close to my planned deposit of £5000. As such I want to iron this out and set multiple stop loss modifications to let my profits run for longer.
How can I connect up multiple stop loss modifications? E.G.
e.g.
move the SL to 2 pips once my trade reaches 10 pip profit
move the SL to 50 pips once I reach 55 pips profit
and move the SL to 90 pips once I reach 100 pips profit
etcUsing Uchidas blocks i have been unable to make any but the first set of blocks work successfully
I really appreciate the help guys =). I hope to have this EA running on a 10x leverage account within 10 months =). My plan is 4 months of back testing and optimisation for different currency pairs, then 6 months forward testing, and if successful then real money.
-
I just added new mode in Trailing stop (each trade), MQL4 only, web version. I marked it as experimental because I'm not sure about it. You can test it and then tell me if it's ok and what should be different.
How it works... you write levels like this:
20/5, 30/10, 45/15
.. which means that when the profit reaches 20 pips, SL will be set to 5 pips (from the Open Price, not from the current price!), at 30 pips of profit SL will be set to 10 and so on...
It's also important to write groups in order starting from the minimum value. 20 first, then 30, then 40... But not 20, 40, 30. This is because MQL4 is very unfriendly when arrays are used and I don't want to add more calculations for sorting.
"Step" is still working. By default it is 1, so we actually have 21/5, 31/10, 46/15. I can exclude it from this mode and set it to always be 0, but... I don't know, people always want more options.
What I don't like in this way is that all numeric values are written in a single string, which means that it will be very ugly if someone wants to use some variable instead. That's why I marked it as experimental.
Otherwise similar functionality can be made using multiple pink blocks. Something like:
For each trade -> pips away from open price -> once per trade/order -> modify stops
but not only this, there must be multiple "pips away from open price" blocks and they must be ordered starting from the biggest profit. Yes, this is also ugly.