Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Double orders running a strategy

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

    Double orders running a strategy

    Hi,

    I am new to programming a strategy. I would like to know whether someone can give me some help?
    When i run the strategy in simulation mode. The strategy when triggered will summit an exit order to close a position before it summits the buy or sell order while there is no position or flat initially.

    Thanks for anyone for any provide some advice and help

    #2
    Hello taihung82, sorry for my late reply here - this can happen in strategy trading and we would call this then a missync situation, so your account not being in sync to what the strategy is believing to be trading coming for the historical chart portion. There are several options in NT handle this effectively, there are outlined here in the helpguide - http://www.ninjatrader.com/support/h..._positions.htm

    Comment


      #3
      Hi, Bertrand

      The problem still persists after i synced the account. I think it is caused by the exit strategy. Can you point me some guide for the code of verifying whether there is a position before summit the exit order.

      Comment


        #4
        Hello taihung82,

        Generally exit orders should require a position before submitting. Exit orders are ignored if there is no position, and you can check for these types of messages by enabling TraceOrders output.
        If you wanted to check by code for this, you could use the line below, which allows you to read the strategy position:
        if (Position.MarketPosition != MarketPosition.Flat) { }
        Last edited by NinjaTrader_RyanM1; 01-04-2012, 04:11 PM.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        152 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        89 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        131 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        127 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        107 views
        0 likes
        Last Post CarlTrading  
        Working...
        X