PosTradeSize  [SOLVED]

Questions about MultiCharts and user contributed studies.
evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

PosTradeSize

Postby evdl » 23 Nov 2016

What I am trying to do is to get every entry- exitname, entry- exitprice, entry- exitsize.

With the PosTrade keywords you can use a counter or PosTradeCount, to get the right "tradenumber"

With the other Postrade keywords (PosTradeEntryPrice, PosTradeEntryName etc) the tradenumber variabel can be calculated with a counter. With PosTradeSize this is different when you have a one entry with multiple exits.

https://www.multicharts.com/trading-sof ... e_Keywords

When the trade is still open, I see no way to get the tradesize of the entries that are already done. It is possible to do this after the trade is closed. But in the trade, when it is still open, the behaviour of PosTradeSize keyword changes.

For example:

You buy 1 shares (this is the first entry)
You buy 2 share (this is the second entry)
You sell 1 share (this is the first exit
You sell 1 share (this is the second exit)
You sell 1 share (this is the third and last exit)

In this case when you use the PosTradesize keyword it will give you:

PosTradeSize(0,0) = 1 at the time the first entry is taken
PosTradeSize(0,1) = 2 at the time the second entry is taken

After the second exit is taken. You can not get the value of 2 with the PosTradeSize keyword anymore,
Not with PosTradeSize(0,0) or PosTradeSize(0,1) or PosTradeSize(0,2) or PosTradeSize(0,3) or PosTradeSize(0,4). Because in the open trade it changed it behaviour and it will only display the tradesize of 1, probably because of matching the entryorder with the exitorders.

How do I get the tradesize as it really happend, when the trade is still open?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: PosTradeSize

Postby Henry MultiСharts » 14 Dec 2016

Hello evdl,

You can check marketposition * currentcontracts to get the direction and amount of contracts in the open position.
There are also various OpenEntry* keywords, ex. OpenEntryContracts - Returns a numerical value, indicating the quantity of contracts of specified entry order into the open position.

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: PosTradeSize

Postby evdl » 14 Dec 2016

Hi Henry,

I am having trouble with the postradesize keyword changing behaviour. The current number of contracts of the open position is easy to get. I'm trying to use the postradesize keyword to get the tradesize of each entry with partial exits of the position, in the situation there still is an open position. You can not use the postradesize keyword anymore in certain circumstances, like described above.

What I am doing now (after a lot of trial and error), use the postrade keyword to set the tradesize of each entry in a variabel at the moment it occurs. And not use it to look back because the keyword changes behaviour with partial exits.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: PosTradeSize

Postby janus » 15 Dec 2016

I found it much easier to keep track of multiple exits by first submitting separate entry orders with different entry labels. Then I use PosTradeEntryName to keep track of the specific order of interest. I use multiple entry orders anyway as my trading strategy enters the market more than once dependent on various confirmation patterns. That way I treat each entry as a "lot" with its own entry label and so it makes tracking of each lot much easier by way of these labels. I never have to worry about partial exists of a specific entry lot. In other words, I treat each lot as a a whole on entry and exit. A lot may be 1 contract or more depending on other factors.

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: PosTradeSize

Postby evdl » 16 Dec 2016

Yes, Janus. I did exactly the same thing with entrynames and use one entry tied to one exit. So if you want to buy 3 lots, I now use 3 different entrynames with each 1 lot.

Did take some time to figure out how the postrade keywords behave in different circumstances. Important to know is that the "tradenumber" in the PostradeEntryname (or exit) is not the "tradenumber" that is used in PosTradeSize or PosTradeProfit keyword.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Re: PosTradeSize  [SOLVED]

Postby janus » 16 Dec 2016

Success!


Return to “MultiCharts”