Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Long/short strategy with cancel order and trail stop

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

    Long/short strategy with cancel order and trail stop

    Would love some help with this strategy if someone could take a look!

    I copied the NT sample on order update strategy template, OnOrderUpdate() method, to attempt the following:

    1. Enter long if Close[1] > Open[1]
    or
    Enter short if Close[1] < Open[1]

    2. Set initial stop loss to n ticks.

    3. Cancel pending order if not filled after n bars.

    4. If n ticks in profit then set stop loss to low/high of Open[1].

    I can get this to happen once! Then the strategy seems to fall down and does not initiate any other orders. So it will submit an order with stop but then if it's not filled it cancels, then stops processing further signals.

    If someone could point out what is wrong with it I would really appreciate it or point me in the direction of a sample strat with long and short entries in it that would achieve the above.


    Thanks!
    Attached Files

    #2
    MrTicks, please ensure the IOrder object is reset to null after the trade is completed - otherwise the entry condition you've got coding in would not trigger.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand, suspected something like that but have no idea where to put that as there are already a few resets in the strat that I copied. Think I'll just find another one to copy, might be easier instead of debugging, have spent too long on it already.
      Last edited by MrTicks; 10-19-2010, 07:07 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by ZenCortexAuCost, Today, 04:24 AM
      0 responses
      5 views
      0 likes
      Last Post ZenCortexAuCost  
      Started by ZenCortexAuCost, Today, 04:22 AM
      0 responses
      2 views
      0 likes
      Last Post ZenCortexAuCost  
      Started by SantoshXX, Today, 03:09 AM
      0 responses
      15 views
      0 likes
      Last Post SantoshXX  
      Started by DanielTynera, Today, 01:14 AM
      0 responses
      3 views
      0 likes
      Last Post DanielTynera  
      Started by yertle, 04-18-2024, 08:38 AM
      9 responses
      42 views
      0 likes
      Last Post yertle
      by yertle
       
      Working...
      X