which entry of a multi entries position was closed?

Questions about MultiCharts and user contributed studies.
oppidum
Posts: 30
Joined: 16 Oct 2014
Has thanked: 31 times
Been thanked: 4 times

which entry of a multi entries position was closed?

Postby oppidum » 17 Jun 2018

Hi,

I can't find anyway way to retrieve the ExitPrice or ExitName of the last closed entry of a position not fully closed?

Example: the strategy is holding a position opened by 3 differents entries. One of this entry get closed but not the position. How to get the information of that exit ( price or name) ?
- with PosTradeEntryName it doesn't seems possible as we don't know the tradeNumber of the closed trade
- with ExitName we can only retrieve the name of the latest order closing the whole position
- and by coding, I can't find a way to retrive this information

Hope I am missing somthing. Thank you for any help.

oppidum
Posts: 30
Joined: 16 Oct 2014
Has thanked: 31 times
Been thanked: 4 times

Re: which entry of a multi entries position was closed?

Postby oppidum » 17 Jun 2018

Well, as the exit respond to a logic or to a reached level, we can artificially retrieve the exit name and price by comparing the price within the bar where an entry was closed with all of the "targeted prices" or exit logics of all the opened entries.

For example, if the target of "entry 3" was at 1.11111 and the bar where an entry was closed reached its high at 1.11120 and its low at 1.11100, we can deduce that "entry 3" is the one who get closed.

Nevertheless, this option sounds artificial, may be relatively inaccurate and complex if many entries and exits logics have to be considered.
It sounds really strange that none of the PLE function/key word's exist to get that information...

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: which entry of a multi entries position was closed?

Postby JoshM » 17 Jun 2018

- with PosTradeEntryName it doesn't seems possible as we don't know the tradeNumber of the closed trade
If I recall correctly, orders are closed in such a manner that the oldest entry order is closed first, then the second oldest, and so on, until you arrive at the first entry in the position. Closing that last one then closes the position.

If that's indeed how your strategy works, then the order number of the most recent exit is the current number of open entries + 1.

Even when I'm off here and your strategy behaves differently, there's likely still a pattern in which you close the multiple entries into a position.

oppidum
Posts: 30
Joined: 16 Oct 2014
Has thanked: 31 times
Been thanked: 4 times

Re: which entry of a multi entries position was closed?

Postby oppidum » 17 Jun 2018

Thank you for your reply Josh.

Yesterday I did some test codes to under better the use of those PosTrad’s functions and the “TradeNumber” parameter keep using the entry sequence. So, PosTradeExitName(0,2) will refer to the exit of the third entry of the actual position (PosTrade functions being zero based), PosTradeExitName(0,0) to the first entry and so on. So if we don’t know the number of the entry the exit is referring to, it seems that we can’t use that function...
Attachments
PosTrade_test02.png
(42.38 KiB) Downloaded 377 times


Return to “MultiCharts”