Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Position.Avgprice

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Position.Avgprice

    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
    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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,404 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by Shai Samuel, 07-02-2022, 02:46 PM
    4 responses
    95 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by DJ888, Yesterday, 10:57 PM
    0 responses
    8 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    159 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Yesterday, 09:29 PM
    0 responses
    8 views
    0 likes
    Last Post Belfortbucks  
    Working...
    X