If I understand correctly, using entryprice(0) should retrieve the most recent entry price of my position.
But if I buy several contracts , this reserved word , still retrieves the first entry out of the multi buying process ...
notice the attached screenshot showing this problem.....
where L-entry in the out put bar shows the entryprice value.
although there was another buy position , it still shows the first @ 6681.5.
If I ask the strategy to buy with -5 decrements from lastentry , then it will not work if it sees the first entry always as the last entryprice.
Please advise
Problem with EntryPrice
Re: Problem with EntryPrice
notice that there are already 2 long positions and in the print file "L-entry" shows the entryprice value of 6681.5 although the most recent buy executed @ 6678.5. So for some reason it will show the value of the first long position no matter how many long position I add..If I understand correctly, using entryprice(0) should retrieve the most recent entry price of my position.
But if I buy several contracts , this reserved word , still retrieves the first entry out of the multi buying process ...
notice the attached screenshot showing this problem.....
where L-entry in the out put bar shows the entryprice value.
although there was another buy position , it still shows the first @ 6681.5.
If I ask the strategy to buy with -5 decrements from lastentry , then it will not work if it sees the first entry always as the last entryprice.
Please advise
How can I fix this ?
If I trade multiple entry and want an exit strategy of entryprice(0) + 0.5 for mini SP and don't mind that older long position that are still opened will not get filled .... ?
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact:
-
- Posts: 40
- Joined: 17 Jul 2007
I am afraid this is how it is in both MC and TS.
If your entry orders are buy/sell next bar at market then you the entry price is simply the open of the next bar; if not, then you can calculate the entry price with a bit of reverse engineering:
MyCurrentContracts = CurrentContracts ;
MyAvgEntryPrice = AvgEntryPrice ;
NewEntryPrice = ( ( CurrentContracts * AvgEntryPrice ) -
( MyCurrentContracts[1] * MyAvgEntryPrice[1] ) ) / ( CurrentContracts - MyCurrentContracts[1] );
I have written a pyramid system where I must calculate the entry price of each entry. I put all entry data in arrays so I can keep track of the list of
entries e.g. entry number - 1, 2, 3, 4; entry bar number, from bar 1 at 930 to bar 390 at 4pm; entry price; number of lots in each entry.
If you are trading multiple entries or pyramiding then you have to keep track of your entries. Hopefully, more support for pyramiding will be included in the next version
Regards,
Deosaran
If your entry orders are buy/sell next bar at market then you the entry price is simply the open of the next bar; if not, then you can calculate the entry price with a bit of reverse engineering:
MyCurrentContracts = CurrentContracts ;
MyAvgEntryPrice = AvgEntryPrice ;
NewEntryPrice = ( ( CurrentContracts * AvgEntryPrice ) -
( MyCurrentContracts[1] * MyAvgEntryPrice[1] ) ) / ( CurrentContracts - MyCurrentContracts[1] );
I have written a pyramid system where I must calculate the entry price of each entry. I put all entry data in arrays so I can keep track of the list of
entries e.g. entry number - 1, 2, 3, 4; entry bar number, from bar 1 at 930 to bar 390 at 4pm; entry price; number of lots in each entry.
If you are trading multiple entries or pyramiding then you have to keep track of your entries. Hopefully, more support for pyramiding will be included in the next version
Regards,
Deosaran
Pyramiding is what I do sometimes. How then would an array be constructed ?I am afraid this is how it is in both MC and TS.
If your entry orders are buy/sell next bar at market then you the entry price is simply the open of the next bar; if not, then you can calculate the entry price with a bit of reverse engineering:
MyCurrentContracts = CurrentContracts ;
MyAvgEntryPrice = AvgEntryPrice ;
NewEntryPrice = ( ( CurrentContracts * AvgEntryPrice ) -
( MyCurrentContracts[1] * MyAvgEntryPrice[1] ) ) / ( CurrentContracts - MyCurrentContracts[1] );
I have written a pyramid system where I must calculate the entry price of each entry. I put all entry data in arrays so I can keep track of the list of
entries e.g. entry number - 1, 2, 3, 4; entry bar number, from bar 1 at 930 to bar 390 at 4pm; entry price; number of lots in each entry.
If you are trading multiple entries or pyramiding then you have to keep track of your entries. Hopefully, more support for pyramiding will be included in the next version
Regards,
Deosaran
could you share some know-how on this for the tracking need ?
Thanks
- Andrew Kirillov
- Posts: 1589
- Joined: 28 Jul 2005
- Has thanked: 2 times
- Been thanked: 31 times
- Contact:
-
- Posts: 10
- Joined: 18 Nov 2010
Re: Problem with EntryPrice
And did you add a separate function already for the entry price problem?could you think of a way to retrieve the entry price using the label of the entry ?This the way it works in TS and MC. I can't imagine a way to fix.
I don't think it is an elegant solution. We just need to add a separate function in the future releases.
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: Problem with EntryPrice
tradeprice,
At the moment entryprice works the following way:
Returns a numerical value, indicating the price at the initial entry into the specified position.
EntryPrice(PosBack)
Where: PosBack - a numerical expression, specifying the position:
0 - open position;
1 - one position back (the last position closed);
2 - two positions back, etc.
If PosBack is not specified, a value for the open position will be returned.
If you use pyramiding, entryprice(0) will return average price for position.
At the moment entryprice works the following way:
Returns a numerical value, indicating the price at the initial entry into the specified position.
EntryPrice(PosBack)
Where: PosBack - a numerical expression, specifying the position:
0 - open position;
1 - one position back (the last position closed);
2 - two positions back, etc.
If PosBack is not specified, a value for the open position will be returned.
If you use pyramiding, entryprice(0) will return average price for position.
Re:
Please do - such a feature is very much needed. More importantly pyramiding features. It should have been there a long time ago but I do understand you are very busy.I don't think it is an elegant solution. We just need to add a separate function in the future releases.could you think of a way to retrieve the entry price using the label of the entry ?This the way it works in TS and MC. I can't imagine a way to fix.
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times