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

NT7 - Mulit-timeframe multi-instrument protective orders

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

    NT7 - Mulit-timeframe multi-instrument protective orders

    All,

    A multi-timeframe multi-instrument strategy is structured to set protective orders using the OnOrderUpdate() method. As outlined in the below linked post.
    http://www.ninjatrader.com/support/forum/showthread.php?t=7499

    In this strategy a position can be triggered from any one of four BarArrays with any entry/exit implemented on one instrument (a futures contract).


    In each of the below orders methods the "BarsInProgress" element must be set to 0. The primary BarsArray, the futures contract all orders are implemented upon:
    • entryOrder = EnterLong(int barsInProgressIndex, int quantity, string signalName)
    • stopOrder = ExitLongStop(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double stopPrice, string signalName, string fromEntrySignal)
    • targetOrder = ExitLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName, string fromEntrySignal)
    PROBLEM 1 - As orders from each of the four BarsArrays are triggered against the same BarsArray, there is no way to tell them apart. And as shorter-timeframe BarsArrays are indexed higher than longer-timeframe BarsArrays (due to the order in which they are "Added"), shorter-timeframe protective orders (when triggered at roughly the same time) over-write the original longer-timeframe protective orders.

    POSSIBLE SOLUTION - Incorporate BarsInProgress in the order signalName:
    entryOrder = EnterLong(int barsInProgressIndex, int quantity, string signalName) becomes entryOrder = EnterLong(0, default, BarsInProgress + " Long") or alternatively BarsInProgress.ToString() + " Long".

    PROBLEM 2 - Despite amending the stopOrder and targetOrder string fromEntrySignal to be the same (i.e. BarsInProgress + " Long") the orders do not appear to be linked to the original entryOrder. As a result the intended trades are eventually closed out at the end of the day as opposed to the intended stopOrder or targetOrder levels.

    Any ideas / suggestions would be greatly appreciated.
    Regards
    Shannon

    #2
    Shannon, the idea to incorporate the BIP generated on into the signalName is a sound one.

    For issue 2 : what is the TraceOrders output showing for those trades? Any Ignored orders? If yes, for what reason would that be?

    Thanks
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand.

      I should have seen it earlier.

      Regards
      Shannon

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by michi08, 10-05-2018, 09:31 AM
      2 responses
      737 views
      0 likes
      Last Post Denver_Wayne  
      Started by sightcareclickhere, Today, 01:55 PM
      0 responses
      1 view
      0 likes
      Last Post sightcareclickhere  
      Started by Mindset, 05-06-2023, 09:03 PM
      9 responses
      258 views
      0 likes
      Last Post ender_wiggum  
      Started by Mizzouman1, Today, 07:35 AM
      4 responses
      18 views
      0 likes
      Last Post Mizzouman1  
      Started by philmg, Today, 01:17 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Working...
      X