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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        160 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        307 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        244 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        348 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        178 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X