![]() |
|
|||||||
| ATM Strategies (Discretionary Trading) Support for Advanced Trade Management, AutoTrail, AutoBreakeven, Stop Strategy and Simulated Stops etc... |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: May 2009
Posts: 60
Thanks: 0
Thanked 0 times in 0 posts
|
Print ("Position.AvgPrice = " + Position.AvgPrice);
EnterLongStop(High[1] + (entry * ATR(14)[0]), ""); Why does this print a value before I have entered the trade? is this Position.AvgPrice looking at my last trade or something??? how do i clear this value or set it to 0 as it seems to be messing up my calculations further on in my code.. or could somebody tell me why this is happening? |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hello James 377,
Position.Avg price returns zero when you're flat. You could check that you are in a position prior to accessing it. if (Position.MarketPosition != MarketPosition.Flat) Print ("Position.AvgPrice = " + Position.AvgPrice);
Ryan M
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| position.AvgPrice causing problems within strategy | suprsnipes | Strategy Development | 7 | 03-19-2010 05:00 AM |
| 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 |
| Why Position.AvgPrice gives not exact price | pmaglio | Strategy Development | 8 | 07-24-2008 12:32 PM |
| Position.AvgPrice | MrBaffalo | Strategy Development | 1 | 05-16-2007 09:01 AM |