Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Positions.MarketPosition

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

    Positions.MarketPosition

    When using the following code, my position ends up +- 10 contracts. Can anyone tell me why?

    Code:
    [FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] (Positions[[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]].MarketPosition!=MarketPosition.Short)
    { 
    EnterShortLimit( [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]5[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2], GetCurrentBid( [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] ), [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"Short"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);
    }
    [/SIZE][/FONT]

    #2
    I suggest debugging your strategy as per here: http://www.ninjatrader-support.com/v...ead.php?t=3627

    Comment


      #3
      OK I have solved my original problem by adding that code to my initialize method. Now when I turn on my strategy, I get the following message...

      8/18/2008 10:39:14 AM Entered internal PlaceOrder() method at 8/18/2008 10:39:14 AM: Action=SellShort OrderType=Limit Quantity=5 LimitPrice=1.8601 StopPrice=0 SignalName='Futures Short' FromEntrySignal=''
      8/18/2008 10:39:14 AM Ignored PlaceOrder() method at 8/18/2008 10:39:14 AM: Action=SellShort OrderType=Limit Quantity=5 LimitPrice=1.8601 StopPrice=0 SignalName='Futures Short' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'

      My position is long 5 contracts, and it is ignoring my orders to sell saying 'Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'. Additionally, my positions are no longer showing up in the Positions tab, they only show in the strategy tab. Also, no orders are showing up in my Orders window anymore either.

      Comment


        #4
        Please consult the docs to understand NT's entry order handling and related options/properties: http://www.ninjatrader-support.com/H...verview36.html

        Comment


          #5
          I cannot find anything in the documentation that explains why my strategies tab shows a position of 5L, however my positions, executions and orders tabs are all blank. This was working for me earlier this am.

          Comment


            #6
            Because the 5L could result from the backtest part of the strategy and does not result in actual/live orders/positions/execution.

            To avoid this you could add
            Code:
            if (Historical)
                 return:
            at the beginning of your OnBarUpdate method

            Comment


              #7
              Great. Thanks for your help!!!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by habeebft, Today, 07:27 AM
              1 response
              11 views
              0 likes
              Last Post NinjaTrader_ChristopherS  
              Started by AveryFlynn, Today, 04:57 AM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by Max238, Today, 01:28 AM
              4 responses
              37 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by r68cervera, Today, 05:29 AM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by geddyisodin, Today, 05:20 AM
              1 response
              14 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X