Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    BertrandNinjaTrader Customer Service

    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 James650, 05-07-2024, 08:25 AM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by xepher101, 05-10-2024, 12:19 PM
        5 responses
        66 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Vitamite, Yesterday, 12:48 PM
        3 responses
        18 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by aligator, Today, 02:17 PM
        0 responses
        17 views
        0 likes
        Last Post aligator  
        Started by lorem, 04-25-2024, 09:18 AM
        22 responses
        96 views
        0 likes
        Last Post lorem
        by lorem
         
        Working...
        X