Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Long & Short Strategy testing logic error?

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

    Long & Short Strategy testing logic error?

    hi,
    i am trying this:

    if (true)
    {
    EnterShortLimit(sentry);
    EnterLongLimit(lentry);
    }

    when i test the strategy i get some results, now if i try it this way:

    if (true)
    {
    EnterLongLimit(lentry);
    EnterShortLimit(sentry);
    }

    i get totally different results:

    i looked at the chart for both strategy results, and it seems if i placed a LONG LIMIT order first, and there was no LONG fill, While the price of the bar hit & passed my SHORT limit order (which was second in the order), i will not get any fills!

    is this normal? how to write such a script???

    Thanks.

    #2
    xbaha,

    The reason this happens is because you actually can't have two working limit orders in opposite directions simultaneously. You can read up on the internal order handling rules which prevents the submission of such an order here: http://www.ninjatrader.com/support/h...d_approach.htm

    Basically what you would need to do is only submit one of the limits at a time. If price moves in the opposite direction closer to your other desired limit you would want to cancel the first, then submit the other instead and just switch back and forth if price keeps moving back and forth.

    An alternative if you really want both orders in at the same time is to use the Unmanaged Approach for order submission, but this is reserved for skilled programmers and system developers who are absolutely certain they know exactly what they are doing because it bypasses any protection NT may provide in the Managed Approach for order errors.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      do you mean the Unmanaged Approach could have errors in the results because the script could have looked ahead?

      Comment


        #4
        xbaha,

        No, unmanaged approach provides you zero safety net. Whatever you tell the strategy to do in terms of order placement is exactly what the strategy will do. There is no hand holding done by NT to try and protect you from erroneous orders or order rejections and such. You can read more about this in the Help Guide: http://www.ninjatrader.com/support/h...d_approach.htm
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by GwFutures1988, Today, 02:48 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by ScottWalsh, 04-16-2024, 04:29 PM
        6 responses
        30 views
        0 likes
        Last Post ScottWalsh  
        Started by frankthearm, Today, 09:08 AM
        10 responses
        36 views
        0 likes
        Last Post frankthearm  
        Started by mmenigma, Today, 02:22 PM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by NRITV, Today, 01:15 PM
        2 responses
        9 views
        0 likes
        Last Post NRITV
        by NRITV
         
        Working...
        X