for eg I have many entry signals in one strategy, and I want to get a entry ("buy name")' total entry shares ,
is there a way?
is there a way to get total shares of specified entry
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: is there a way to get total shares of specified entry
This can be retrieved with the PosTradeSize() keyword.Re: is there a way to get total shares of specified entry
for eg I have many entry signals in one strategy, and I want to get a entry ("buy name")' total entry shares ,is there a way?
If you want to work with the entry name as a workaroud, instead of the trade count number (that is needed for use with `PosTradeSize()`), see PosTradeEntryName().
-
- Posts: 11
- Joined: 21 Jan 2015
Re: is there a way to get total shares of specified entry
Hi thanks for reply.
since the order is triggered by condition,so I dont know the order number ie pos TradeNumber.
I want to retrieve order size by entry name,something like PosTradeSize(PosAgo, entryname)
since the order is triggered by condition,so I dont know the order number ie pos TradeNumber.
I want to retrieve order size by entry name,something like PosTradeSize(PosAgo, entryname)
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: is there a way to get total shares of specified entry
I think you can combine `PosTradeSize()` with PosTradeCount() for that. Because `PosTradeCount()` returns how many trades (i.e., entries) there were into a specific position.since the order is triggered by condition,so I dont know the order number ie pos TradeNumber.
I want to retrieve order size by entry name,something like PosTradeSize(PosAgo, entryname)
If you loop through all `PosTradeCount()` trades for a specific position, you can use the `PosTradeEntryName()` to check whether the different trades have the entry name you're looking for.
For example (untested, but to highlight the idea):
Code: Select all
Variables:
entryNameLookingFor("ABCDEF"),
currentEntryName(""),
sharesOfSpecificEntry(0),
x(0);
for x = 0 to PosTradeCount(1) {previous position} begin
currentEntryName = PosTradeEntryName(1, x);
if (currentEntryName = entryNameLookingFor) then begin
sharesOfSpecificEntry = PosTradeSize(1, x);
break;
end;
end;
Print("There were ", sharesOfSpecificEntry,
" shares in the entry with name ",
entryNameLookingFor);