Help w/ setting profit & BE on market order at specified level
4 replies
IvanD1983
5 years ago #236629
Hi Tomas et all,
NOTE: I get the notification that the sqw file cannot be uploaded for security reasons. How to send it?
I’ve developed an EA that is 90% done. The 10% left, while coded, is still not executed as it’s supposed to.
I’d be most grateful if you could have a look and try to find out where I may have erred. Find the EA attached.
A brief explanation of the impasse I am facing:
Don’t be shocked by the number of tabs as part of the EA. The majority are duplicated functions. Essentially, the EA aims to enter either a market order or a limit order at specific levels (i can define 3 levels up and 3 down) if a concrete pattern takes place.
When the pattern is validated but the distance from the trigger candle to the stop placement is larger than 20 pips (say 30 pips), it sets a limit order at 20 pips distance from the stop. Almost everything works fine here as the EA obeys the call to set take profit XX times the variable that I specify. ie/ set take profit 20pips x 2.3 times. However, if my take profit is 40 pips, i notice my move to breakeven, determined at 20 pips, only occurs if there is a close beyond 20 pips. Is that possible? How can i set the breakeven to move to break even the moment the price runs 20 pips in my favor?
That said, the main issue becomes when I enter off the specified level and the candle trigger as part of the pattern to get me into the trade is less than 20 pips distance from the stop. In this case, the EA enters a market order. My struggle is to set the proper take profits of 2 times the distance from the market order to the stop as well as the execution to move to break-even. In other words, if the separation from the trigger candle to the stop is only 15p, i need the EA to identify a take profit of 30 pips and move to break even at 15 pips. So far, I am not getting that, but instead, some random profit taking values of 1:1 or thereabouts.
Check the last 2 tabs, which is where I create the logic to identify the value of the take profit and break even on market orders. These 2 tabs create the variables and values needed to use on the tabs referred as “Long/Short DTFL MO (Market Order) L1/2/3″… The issue affects these 6 tabs, as each specifies entering a market order long or short at level 1, level 2 or level 3. The other 6 tabs “Long/Short DTFL LO (Limit Order) L1/2/3” are OK, subject to tips on moving to breakeven at 1:1 as per 1st issue discussed above.
I am now at the stage where I am simply banging my head on the wall trying to helplessly come up with a solution that I cannot find by myself. The issue, I am quite convinced, lies in how I go about the logic of the last 2 tabs.
Whatever it takes, I really need to get to the bottom of it. I hope you can be of assistance as you’ve always been.
Thanks!
IvanD1983
5 years ago #236631
I am having issues uploading the sqw file. Retrying here.
IvanD1983
5 years ago #236633
Hi Tomas,
You can download the sqw file via dropbox. That’s the only way I found.
https://www.dropbox.com/s/8ldqkxbfexbjtqa/DTFL%20EA%20v1.3%20new.sqw?dl=0
Thanks.
tomas262
5 years ago #236661
Hi, sure, I will check the attached project. You can upload zip files here if needed
IvanD1983
5 years ago #236682
Viewing 4 replies - 1 through 4 (of 4 total)