Advanced SL EA
18 replies
Uwe6000
6 years ago #203521
Hello, I want to create the following profitable SL-EA, but it’s not easy.
Especially the values “current course” + “current SL” and distance from course to MA.
Example:
1. SL = Low (2)
2.
Current price is> 40 pips from the opening price of my order (break even)
then: set SL to break even + current spread
3.
if Close Low (1)> current SL
then: move SL to Low (1)
4.
SMA10 + 10 pips distance => current SL
then: move SL to SMA10 + 10 pips distance
5.
if gap current rate is greater than 40 pips to the SMA10
then: move SL + 30% of the distance from the SMA10 to the current price
How can you realize that?
Thank you for ideas or examples.
tomas262
6 years ago #203650
Uwe6000
6 years ago #203653
Hello, yes i like to combine all these
tomas262
6 years ago #203689
Uwe6000
6 years ago #203748
for the file , i have an error “custom function” maybe. Its not possible here to paste the source code with the error. here`s a picture…
Uwe6000
6 years ago #203747
Hello, it looks very good, but i become an error from (custom function). How can i fix it ?
From source code:
“Exception:
Only elements with no child elements can be processed as text.
This element with name “param” has a child element named: values
The problematic instruction:
———-
==> if-else [on line 85, column 7 in Mql_MT4/BuildingBlocks.inc]
in user-directive compress [on line 82, column 51 in Mql_MT4/BuildingBlocks.inc]
……
———-
Java backtrace for programmers:
———-
freemarker.template.TemplateModelException: Only elements with no child elements can be processed as text.
This element with name “param” has a child element named: values
….. and so on…
tomas262
6 years ago #203810
Hello,
ok, resaved + pictures of the setup attached
Bear in mind you need to use brackets at the end of OrderStopLoss() (it is not visible within condition)
Uwe6000
6 years ago #203938
Hello, Unfortunately, that does not work for me yet. I get back the error messages in the source code here…
tomas262
6 years ago #204012
Hello,
please try to apply the patch files attached onto your EA Wizard folder, restart EA Wizard and try to re-export the strategy
Uwe6000
6 years ago #217737
Hi tomas, thank you it`s working now. My installation was on drive D: , and install new on C: and use the files…
second question to 3. above
>>>>(
if Close Low (1)> current SL
then: move SL to Low (1))<<<<
i like to save the position fast, if the Low[1] higher as the Order Start-Price and Spread – then set SL to Breakeven. But in menu “Enter the Market” > “Move SL to Breakeven” can set only Pips? How can i do this ?
tomas262
6 years ago #217741
Uwe6000
6 years ago #233190
hello,
if i like to trail from SL to BE with ema30 example, i try at “MoveStopLoss to BreakEven” ema30 as variable ?
The trailing will stopped at BE ? (thats what i like, because over OrderOpeningPrice i like to trail with other trailing…
Uwe6000
6 years ago #233194
hello, the test with variable at “MoveStopLoss to BreakEven” is not so good, because the SL will be set on BE without trailing , if the EMA30 = BE.
i like to trail the EMA30 if close>open from SL only to BE. After this i like to trail EMA 50 , if the Price is 10pips higher as the SL
Currently i have no solution, how can i do this.
many greetings and thanks for an example
tomas262
6 years ago #233220
So until BE yo want to trail using EMA 30 and after using EMA 50 ? I can make an example on this. 10 pips is the trail distance?
Uwe6000
6 years ago #233233
Hello, yes until BE trail ema30, mean the trailing ema30 stop is on BE. Later, price is 10 pips higher as SL ( on BE) then trail ema50. The 10 pips is not the trail distance, is the distance for the second ema50 trail to BE. The ema50 trailing starts 10 pips over Opening Price ( BE) and not immediately. Thank you for example
tomas262
6 years ago #233238