![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Dec 2008
Posts: 338
Thanks: 0
Thanked 0 times in 0 posts
|
Greets,
I am trying to 'capture' the price of the entry, when the order is placed, for further use. Code:
privatedouble MyEnterP125 = 0;
protectedoverridevoid OnBarUpdate()
{ sThisPrice.Set(Position.AvgPrice);
{ if ( (Position.MarketPosition == MarketPosition.Flat) && (timeSeries[0] >= 1) )
// Try to go LONG
{ if ( WatchToGoLong == 1 )
.................
if ((iOrderL5 == null || Historical) && iQuantity5 != 0)
{ iOrderL5 = EnterLong(0, iQuantity5, sENTRY5L);
MyEnterP125 = sThisPrice[0];
Print("Entry Price PT125 "+MyEnterP125);
}
MyEnterP125 = Position.AvgPrice; (without using the DataSeries.Set etc) ... everything compiles but I only get '0' (as in MyEnterP125 = 0; ) at the print during the strategy run on whatever attempt that does compile ... Obviously missing something ... ![]() Any assist is appreciated! Thanks, Jon
Last edited by Trader.Jon; 03-21-2011 at 01:52 AM.
|
|
|
|
|
|
#2 |
|
Senior Member
|
Your brackets look funny. Are you sure that you have posted the correct code?
|
|
|
|
|
|
#3 | |
|
Senior Member
Join Date: Mar 2009
Posts: 442
Thanks: 0
Thanked 25 times in 16 posts
|
Quote:
immediately after executing an Enter..(). You can place it in OnExecution() or query it on the next bar. Baruch |
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Dec 2008
Posts: 338
Thanks: 0
Thanked 0 times in 0 posts
|
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Dec 2008
Posts: 338
Thanks: 0
Thanked 0 times in 0 posts
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Clarification on Position.AvgPrice and Position.MarketPosition | skyholder84 | Automated Trading | 1 | 12-26-2010 09:55 AM |
| Position.Avgprice | james377 | ATM Strategies (Discretionary Trading) | 1 | 11-01-2010 04:24 PM |
| Position.AvgPrice | Faspomy | Strategy Development | 7 | 02-16-2010 10:52 AM |
| Position.AvgPrice Real Value | daven | Automated Trading | 1 | 10-30-2008 09:31 AM |
| Position.AvgPrice | MrBaffalo | Strategy Development | 1 | 05-16-2007 09:01 AM |