Exits on ATM closes on different days on a losing trade

I've noticed when you have two exits on ATM, let's say.

- 1st Exit: Profit Target
- 2nd Exit: Exit Rule


Generally when I lose the trade because it hits the Exit Rule before hitting Profit Target,
It doesn't close both positions at the same bar; one closes the exit day as expected, but the second position closes the next day like the attached picture.



Attachments
Screen Shot 2021-04-28 at 001625.png
(40.43 KiB)
  • Votes +1
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

CG
#1

Chris G

28.04.2021 06:29

Task created

CG
#2

Chris G

28.04.2021 06:31
Voted for this task.
MF
#3

Mark Fric

14.05.2021 08:46

Status changed from New to Waiting for information

what exactly is the error? These two exits are independent of each other, so they can end on different bars,
CG
#4

Chris G

14.05.2021 15:39
Hi Mark,


Let's say I have opened two positions long.

One exit is meant to close 50% the position at a fixed profit, let's say when price hits 5 ATR from initial price: https://i.imgur.com/FB98EYu.png

The second exit is meant to close the remaining 50% on the exit rule: https://i.imgur.com/YFmcdy7.png

If the trade hits the profit target before hitting the exit rule, it will look good as expected : https://i.imgur.com/aQYsaBU.png

But if the trade hits the exit rule before hitting the profit target, it look like this:

https://i.imgur.com/C4Zqeok.png

https://i.imgur.com/6OUsSpg.png


In both cases, the first position closes at the exit rule as expected but the second position will close always the next day, causing a major loss.

It would be nice if both positions had closed at the same bar when the exit rule is triggered before hitting profit target.



MF
#5

Mark Fric

18.05.2021 12:12
I understand now, but it might be difficult to reproduce it. 


From only the screenshots it is not sure why it closed on the next day, it could have been StopLoss.


Can you attach your strategy?

CG
#6

Chris G

18.05.2021 15:58

Attachment Test 3.sqx added

Test 3.sqx
(57.95 KiB)
I've attached the strategy using the following ATM configuration in the builder:

https://i.imgur.com/RgCNluU.png


The trades you can see the issue are:

Trade #7: https://i.imgur.com/WMGf4hB.png

Trade #23: https://i.imgur.com/XHrtKI0.png

Trade #27: https://i.imgur.com/0iHDkri.png


Also I've noticed today that there's a difference between Builder and AlgoWizard using the same ATM configuration and strategy:

Builder: https://i.imgur.com/OtV5vFo.png

AlgoWizard: https://i.imgur.com/gOU2B7j.png








MF
#7

Mark Fric

20.05.2021 14:17

Status changed from Waiting for information to Fixed

ok, I got the issue now.


I fixed one bug there, but the way ATM is behaving together with Exit rules is probably different than you expect. ATM doesn't disable the exit rule, so when exit rule is triggered it should close your full position, not only half of it.


It works as you expect only if PT is reached before exit rule is triggered. I added a note about this to ATM Settings documentation.


If you'd want to ignore exit rule for ATM it would have to be made in a special way, I'm not sure this is something people would want.


CG
#8

Chris G

20.05.2021 15:28
I didn't expect that ATM disable exit rule. 

To the contrary, exit rule always should close all positions when exit rule triggers, but the same day.

The bug I saw was in the case we don't reach the profit target yet and exit rule is triggered, so one of the positions closes as expected but the remaining position closes the next candle.

I found ATM useful, but I think it will be more useful when we could apply SL, Trailing Stop, SL to BE and SL to BE Add Pips to every position, independently.

Do you know if this feature will be available for Build 132?

MF
#9

Mark Fric

21.05.2021 08:14

Attachment image-0.png added

image-0.png
(58.69 KiB)
this was the bug I fixed - the problem was that exit rule used Close position, and that closed only frst of the ATM positions.


It should be changed like in the screenshot.


Votes: +1

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please