Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problems when running in live sim (market playback)...

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

    Problems when running in live sim (market playback)...

    I am trying to run a strategy in live sim using market playback, and seem to be having some very odd issues....

    there are a couple of points during my strategy where it seems to get "stuck" at a certain point in the day... by stuck I mean it will work properly, and then at random points it will just open/close a flood of different orders on the same bar...

    I am using 233 ticks...

    any ideas?
    Last edited by BigDog008; 03-22-2009, 01:39 AM.

    #2
    BigDog008,

    Are you using CalculateOnBarClose = false? If so, this could happen if your trade condition remains consistently true. Please debug your orders with TraceOrders = true. http://www.ninjatrader-support2.com/...ead.php?t=3627
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      **just realized posted in the wrong forum... hope a mod wouldn't mind moving this from file sharing diss. to strat. develop.**

      I am using CalculateOnBarClose = false


      I've been scratching my head for a while now... still can't seem to figure out what's going on.... when I do only Shorts or only Longs.... the strategy generates orders accordingly... but when I involve both Longs and Shorts... it seems to fall apart...

      could you take a peek at what ive done i'd really appreciate it.... driving me nuts first thing on a sunday morning!

      Code:
      {
          /// <summary>
          /// Enter the description of your strategy here
          /// </summary>
          [Description("Enter the description of your strategy here")]
          public class TestStrategy : Strategy
          {
              #region Variables
              // Wizard generated variables
              private int aTRPeriod = 1; // Default setting for ATRPeriod
              private int eMAPeriod = 1; // Default setting for EMAPeriod
              private double aTRTrigger = 0.000; // Default setting for ATRTrigger
              // User defined variables (add any user defined variables below)
              #endregion
      
              /// <summary>
              /// This method is used to configure the strategy and is called once before any strategy method is called.
              /// </summary>
              protected override void Initialize()
              {    
                  SetTrailStop("Long A", CalculationMode.Ticks, 8, false);
                  SetTrailStop("Short A", CalculationMode.Ticks, 8, false);
                  TraceOrders      = true;
                  CalculateOnBarClose = false;
              }
      
              /// <summary>
              /// Called on each bar update event (incoming tick)
              /// </summary>
              protected override void OnBarUpdate()
              {
                  if (ATR(ATRPeriod)[0] > ATRTrigger
                      && EMA(Close, EMAPeriod)[0] > EMA(Close, EMAPeriod)[2])
                  {
                      EnterShort(DefaultQuantity, "Short A");
                  }
                              
                  if (ATR(ATRPeriod)[0] > ATRTrigger
                      && EMA(Close, EMAPeriod)[0] < EMA(Close, EMAPeriod)[2])
                  {
                      EnterLong(DefaultQuantity, "Long A");
                  }
              }    
              
      
              #region Properties
              [Description("")]
              [Category("Parameters")]
              public int ATRPeriod
              {
                  get { return aTRPeriod; }
                  set { aTRPeriod = Math.Max(1, value); }
              }
      
              [Description("")]
              [Category("Parameters")]
              public int EMAPeriod
              {
                  get { return eMAPeriod; }
                  set { eMAPeriod = Math.Max(1, value); }
              }
      
              [Description("")]
              [Category("Parameters")]
              public double ATRTrigger
              {
                  get { return aTRTrigger; }
                  set { aTRTrigger = Math.Max(0.000, value); }
              }
              #endregion
          }
      }
      Last edited by BigDog008; 03-22-2009, 10:11 AM.

      Comment


        #4
        Hello,

        Are orders closing unexpectedly? If so, it is because you cannot be literally long and short within the same market. If you have an open order and you submit an opposing order, the first order will be closed automatically.

        If that is not what is going on, please tell us in detail and we will try to help.
        DenNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by traderqz, Today, 12:06 AM
        5 responses
        8 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Mongo, Today, 11:05 AM
        2 responses
        7 views
        0 likes
        Last Post Mongo
        by Mongo
         
        Started by guillembm, Today, 11:25 AM
        0 responses
        3 views
        0 likes
        Last Post guillembm  
        Started by Tim-c, Today, 10:58 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by traderqz, Yesterday, 09:06 AM
        4 responses
        29 views
        0 likes
        Last Post traderqz  
        Working...
        X