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

exact time filters.

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

    #16
    Originally posted by NinjaTrader_Emily View Post

    Code:
    so it would be possible to create an identical strategy without stop loss orders using the EnterShort(0,commands and designating the primary and secondary series inside each section as appropriate. ¿is this correct?
    Are you referring to an "identical strategy" as in a strategy that behaves the same as versions b and c? I am not sure what you mean by "without stop orders" either. This needs to be clarified so I can ensure I understand you before confirming or denying this point.

    a strategy that uses two bar indices and sends orders inside the primary and secondary series sections without specifying the bar index for the entries will have some entries on the primary series and some on the secondary series. this same structure can be replicated using the more advanced entry orders that do specify the bar index for the entries. so, it should be possible to make adjustments to versions b and c and have the exact same performance as version a, but only if the stop loss orders are disabled. however, it is not possible to refine version a to deliver the same behavior as versions b and c. this has been proven with my previous posts.


    Originally posted by NinjaTrader_Emily View Post
    The logic you have in place for SetStopLoss() in version a is as follows:
    Code:
     SetStopLoss(@"shortentry1", CalculationMode.Ticks, Stopsize, false);
    SetStopLoss(@"shortentry2", CalculationMode.Ticks, Stopsize, false);
    SetStopLoss(@"longentry1", CalculationMode.Ticks, Stopsize, false);
    SetStopLoss(@"longentry2", CalculationMode.Ticks, Stopsize, false);
    ​
    If you had entries inside of the BarsInProgress == 1 section that have the aforementioned entry signals, then stop loss orders could still be generated for entries generated inside of that section of code. What exactly are you looking to achieve by separating your logic between your BarsInProgress == 0 and BarsInProgress == 1 sections?

    i don't agree with this. some time ago i developed strategies with different entries in the two bar indices and the stop loss orders would only work for the entries and positions on the primary series. i could try to prove this. i had an initial entry generated by the primary series and then the smaller time frame would generate a pullback entry in some special cases but the stop loss orders would never work on these entries.


    and i'm not interested in separating entries between series, i'm trying to get consistent results with time filters because there are enormous differences when using basic EnterShort( and SetStopLoss( commands versus strategies where i use the onorder and execution update logic. also, time filters for the nasdaq regular session work well as this is a restriction over the same day, but when i try to restrict trades for the cme regular session (18:00 to 17:00 the next day) the filters will fail completely.
    Last edited by rtwave; 01-22-2024, 02:11 PM.

    Comment


      #17



      people with nt,




      i'm trying to make time filters in nt work.



      i'm now working exclusively on version c of the strategies i posted previously. once that particular strategy works as intended my plan is to use it as a template and just change the position generation engine. the larger bars will open short positions on downtrends, long positions on uptrends, no positions in the absence of trends and the smaller bars are only intended to accurately enforce time limits for positions.



      i'm evaluating version c on the rty on 73 minute bars from 06-01-2024 to date.



      t0 08-Jan-24 01:18:00 - t1 08-Jan-24 01:20:00 - conditionshort False - conditionlong True - marketposition Flat
      t0 08-Jan-24 01:18:00 - t1 08-Jan-24 01:30:00 - conditionshort False - conditionlong True - marketposition Flat
      t0 08-Jan-24 01:18:00 - t1 08-Jan-24 01:40:00 - conditionshort False - conditionlong True - marketposition Flat
      t0 08-Jan-24 01:18:00 - t1 08-Jan-24 01:50:00 - conditionshort False - conditionlong True - marketposition Flat
      t0 08-Jan-24 01:18:00 - t1 08-Jan-24 02:00:00 - conditionshort False - conditionlong True - marketposition Flat
      t0 08-Jan-24 01:18:00 - t1 08-Jan-24 02:10:00 - conditionshort False - conditionlong True - marketposition Flat
      t0 08-Jan-24 01:18:00 - t1 08-Jan-24 02:20:00 - conditionshort False - conditionlong True - marketposition Flat
      t0 08-Jan-24 01:18:00 - t1 08-Jan-24 02:30:00 - conditionshort False - conditionlong True - marketposition Flat
      t0 08-Jan-24 02:31:00 - t1 08-Jan-24 02:40:00 - conditionshort True - conditionlong False - marketposition Flat
      t0 08-Jan-24 02:31:00 - t1 08-Jan-24 02:50:00 - conditionshort True - conditionlong False - marketposition Flat
      t0 08-Jan-24 02:31:00 - t1 08-Jan-24 03:00:00 - conditionshort True - conditionlong False - marketposition Flat



      the code that alternates a condition bar to bar works to perfection throughout all tests i have performed.


      here, the first problem starts at 09:30:


      t0 08-Jan-24 08:36:00 - t1 08-Jan-24 09:20:00 - conditionshort False - conditionlong True - marketposition Flat
      t0 08-Jan-24 08:36:00 - t1 08-Jan-24 09:30:00 - conditionshort False - conditionlong True - marketposition Flat
      08-Jan-24 08:36:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 08-Jan-24 08:36:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry1' FromEntrySignal=''
      08-Jan-24 08:36:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 08-Jan-24 08:36:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry2' FromEntrySignal=''
      t0 08-Jan-24 08:36:00 - t1 08-Jan-24 09:40:00 - conditionshort False - conditionlong True - marketposition Flat
      08-Jan-24 09:49:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 08-Jan-24 09:49:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='shortentry1' FromEntrySignal=''
      08-Jan-24 09:49:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 08-Jan-24 09:49:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='shortentry2' FromEntrySignal=''
      08-Jan-24 09:49:00 Strategy 'sampletimefilters1c/-1': Cancelled pending entry order on opposite side of the market: BarsInProgress=0, orderId='NT-00002-2150' account='Backtest' name='shortentry1' orderState=Working instrument='RTY 03-24' orderAction=SellShort orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-08 09:49:00' gtd='2099-12-01' statementDate='2024-01-24'
      08-Jan-24 09:49:00 Strategy 'sampletimefilters1c/-1': Cancelled pending entry order on opposite side of the market: BarsInProgress=0, orderId='NT-00003-2150' account='Backtest' name='shortentry2' orderState=Working instrument='RTY 03-24' orderAction=SellShort orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-08 09:49:00' gtd='2099-12-01' statementDate='2024-01-24'
      08-Jan-24 09:49:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 08-Jan-24 09:49:00: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=1162.6 SignalName='longstoplossorentry1' FromEntrySignal='longentry1'
      08-Jan-24 09:49:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 08-Jan-24 09:49:00: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=1162.6 SignalName='longstoplossorentry2' FromEntrySignal='longentry2'
      t0 08-Jan-24 09:49:00 - t1 08-Jan-24 09:50:00 - conditionshort True - conditionlong False - marketposition Long
      t0 08-Jan-24 09:49:00 - t1 08-Jan-24 10:00:00 - conditionshort True - conditionlong False - marketposition Long
      t0 08-Jan-24 09:49:00 - t1 08-Jan-24 10:10:00 - conditionshort True - conditionlong False - marketposition Long​



      the logs state that conditionlong is true a 09:30, so what i would want is for marketposition to be long starting at that exact time and until the condition changes. i don't understand why the strategy seemingly sends two market orders and then reports marketposition flat again at 09:40. then, at 09:50 conditionshort is true, conditionlong is false but still the strategy reports that it found a way to make a mess and end up with a long position.


      after this debacle, the alternating condition and marketposition will coincide for the rest of the session.



      so, my question is, ¿how can this code be corrected so that the strategy will have a position with two entries in synchrony with the short - long condition starting at 09:30?


      if(BarsInProgress == 0)
      {



      if (CurrentBar % 2 == 0)
      {
      conditionshort = true;
      conditionlong = false;
      if ( (Position.MarketPosition != MarketPosition.Short)
      && (Times[1][0].TimeOfDay >= 09:30.TimeOfDay)
      && (Times[1][0].TimeOfDay < 15:49.TimeOfDay) )
      {
      if ( Trade01short == true )
      {
      EnterShort(0, Convert.ToInt32(Position1), @"shortentry1");
      }
      if ( Trade02short == true )
      {
      EnterShort(0, Convert.ToInt32(Position2), @"shortentry2");
      }
      }
      }​



      else if(BarsInProgress == 1)
      {



      if ( (conditionshort == true)
      && (Times[1][0].TimeOfDay >= 09:29.TimeOfDay)
      && (Times[1][0].TimeOfDay < 09:29.AddMinutes(4).TimeOfDay)
      && (Position.MarketPosition != MarketPosition.Short) )
      {
      if ( Trade01short == true )
      {
      EnterShort(0, Convert.ToInt32(Position1), @"shortentry1");
      }
      if ( Trade02short == true )
      {
      EnterShort(0, Convert.ToInt32(Position2), @"shortentry2");
      }
      }​
      Last edited by rtwave; 01-29-2024, 12:08 PM.

      Comment


        #18
        Hello rtwave,

        Thank you for your reply.

        You will need to add additional debugging prints to better understand your strategy's behavior and identify what needs to be adjusted in order to have the desired position at 9:30. For example, you should print all values used in your entry condition both outside of an inside of the condition:

        Code:
        Print(string.Format("{0} MarketPosition: {1} != MarketPosition.Short: {2} Times[1][0].TimeOfDay: {3} >= 09:30: {4} < 09:30: {5}" Times[1][0], Position.MarketPosition, Position.MarketPosition != MarketPosition.Short, Times[1][0].TimeOfDay, Times[1][0].TimeOfDay >= 09:30.TimeOfDay, Times[1][0].TimeOfDay < 09:30.TimeOfDay));
        
        if ( (Position.MarketPosition != MarketPosition.Short)
        && (Times[1][0].TimeOfDay >= 09:30.TimeOfDay)
        && (Times[1][0].TimeOfDay < 09:30.TimeOfDay) )
        {
        if ( Trade01short == true )
        {
        Print("Condition met! Trade01short: " + Trade01short);
        Print(string.Format("{0} MarketPosition: {1} != MarketPosition.Short: {2} Times[1][0].TimeOfDay: {3} >= 09:30: {4} < 09:30: {5}" Times[1][0], Position.MarketPosition, Position.MarketPosition != MarketPosition.Short, Times[1][0].TimeOfDay, Times[1][0].TimeOfDay >= 09:30.TimeOfDay, Times[1][0].TimeOfDay < 09:30.TimeOfDay));
        EnterShort(0, Convert.ToInt32(Position1), @"shortentry1");
        }
        if ( Trade02short == true )
        {
        Print("Condition met! Trade02short: " + Trade02short);
        Print(string.Format("{0} MarketPosition: {1} != MarketPosition.Short: {2} Times[1][0].TimeOfDay: {3} >= 09:30: {4} < 09:30: {5}" Times[1][0], Position.MarketPosition, Position.MarketPosition != MarketPosition.Short, Times[1][0].TimeOfDay, Times[1][0].TimeOfDay >= 09:30.TimeOfDay, Times[1][0].TimeOfDay < 09:30.TimeOfDay));
        EnterShort(0, Convert.ToInt32(Position1), @"shortentry1");​
        EnterShort(0, Convert.ToInt32(Position2), @"shortentry2");
        }
        }​
        Something to keep in mind; does it make sense that both of the following could be true at the same time?
        (Times[1][0].TimeOfDay >= 09:30.TimeOfDay) && (Times[1][0].TimeOfDay < 09:30.TimeOfDay)

        Can the time of the current bar be both greater than or equal to 9:30 AND less than 9:30 simultaneously? If you are seeing that this condition is never triggered, it could be do to conflicting values in the condition.

        Another item to keep in mind is that State.Historical is processed On Bar Close. If the condition becomes true for a bar, the action will be triggered on the close of that bar so, for example, if an entry is triggered you will see that entry timestamped on the bar AFTER the condition became true.

        Please let us know if we may be of further assistance.​
        Emily C.NinjaTrader Customer Service

        Comment


          #19




          people with nt,



          i have corrected the " greater than or equal to 9:30 AND less than 9:30 " situation. i made a small mistake when pasting the code and replacing the variables in the strategy with the values used for the tests. it can be easily confirmed that that is not a problem in the strategy i have shared.



          and i really consider support to be poor in this case. i have provided the simplest possible strategy, completely time based and focused on getting time filters to work properly. nt always asks for prints and this time i have shared all the relevant prints. i waited over the entire weekend for advice on how to get time filters to work and then nt will just ask for more prints, as is always the case. come on. and nt refers to " your strategy " like it was some esoteric piece of code i was not sharing on these fora, when this is really the simplest possible piece of code one can put together. if a bar's bar number is odd, the strategy should create a short position and a long position in the case of even bars.



          Trade01short and Trade02short are just public variables, or inputs, that the user deliberately sets so there is no point in monitoring whether or not any conditions are met.



          i have run a backtest on 93 minute bars and once again the strategy will fail to perform as intended right around 09:30 hours.


          t0 15-Jan-24 07:57:00 - t1 15-Jan-24 09:10:00 - conditionshort True - conditionlong False - marketposition Flat
          t0 15-Jan-24 07:57:00 - t1 15-Jan-24 09:20:00 - conditionshort True - conditionlong False - marketposition Flat
          15-Jan-24 09:30:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 15-Jan-24 09:30:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry1' FromEntrySignal=''
          15-Jan-24 09:30:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 15-Jan-24 09:30:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry2' FromEntrySignal=''
          t0 15-Jan-24 09:30:00 - t1 15-Jan-24 09:30:00 - conditionshort False - conditionlong True - marketposition Flat
          15-Jan-24 09:30:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 15-Jan-24 09:30:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry1' FromEntrySignal=''
          15-Jan-24 09:30:00 Strategy 'sampletimefilters1c/-1': Ignored SubmitOrderManaged() method at 15-Jan-24 09:30:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry1' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
          15-Jan-24 09:30:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 15-Jan-24 09:30:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry2' FromEntrySignal=''
          15-Jan-24 09:30:00 Strategy 'sampletimefilters1c/-1': Ignored SubmitOrderManaged() method at 15-Jan-24 09:30:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry2' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
          15-Jan-24 09:30:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 15-Jan-24 09:30:00: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=1157.6 SignalName='longstoplossorentry1' FromEntrySignal='longentry1'
          15-Jan-24 09:30:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 15-Jan-24 09:30:00: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=1157.6 SignalName='longstoplossorentry2' FromEntrySignal='longentry2'
          t0 15-Jan-24 09:30:00 - t1 15-Jan-24 09:40:00 - conditionshort False - conditionlong True - marketposition Long
          t0 15-Jan-24 09:30:00 - t1 15-Jan-24 09:50:00 - conditionshort False - conditionlong True - marketposition Long
          t0 15-Jan-24 09:30:00 - t1 15-Jan-24 10:00:00 - conditionshort False - conditionlong True - marketposition Long
          t0 15-Jan-24 09:30:00 - t1 15-Jan-24 10:10:00 - conditionshort False - conditionlong True - marketposition Long
          t0 15-Jan-24 09:30:00 - t1 15-Jan-24 10:20:00 - conditionshort False - conditionlong True - marketposition Long
          t0 15-Jan-24 09:30:00 - t1 15-Jan-24 10:30:00 - conditionshort False - conditionlong True - marketposition Long
          t0 15-Jan-24 09:30:00 - t1 15-Jan-24 10:40:00 - conditionshort False - conditionlong True - marketposition Long
          t0 15-Jan-24 09:30:00 - t1 15-Jan-24 10:50:00 - conditionshort False - conditionlong True - marketposition Long
          t0 15-Jan-24 09:30:00 - t1 15-Jan-24 11:00:00 - conditionshort False - conditionlong True - marketposition Long
          15-Jan-24 11:03:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 15-Jan-24 11:03:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='shortentry1' FromEntrySignal=''
          15-Jan-24 11:03:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 15-Jan-24 11:03:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='shortentry2' FromEntrySignal=''
          15-Jan-24 11:03:00 Strategy 'sampletimefilters1c/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00002-87444' account='Backtest' name='longstoplossorentry1' orderState=Working instrument='RTY 03-24' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=1157.6 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-15 09:30:00' gtd='2099-12-01' statementDate='2024-01-29'
          15-Jan-24 11:03:00 Strategy 'sampletimefilters1c/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00003-87444' account='Backtest' name='longstoplossorentry2' orderState=Working instrument='RTY 03-24' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=1157.6 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-15 09:30:00' gtd='2099-12-01' statementDate='2024-01-29'
          15-Jan-24 11:03:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 15-Jan-24 11:03:00: BarsInProgress=0 Action=BuyToCover OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=2760.6 SignalName='shortstoplossorentry1' FromEntrySignal='shortentry1'
          15-Jan-24 11:03:00 Strategy 'sampletimefilters1c/-1': Entered internal SubmitOrderManaged() method at 15-Jan-24 11:03:00: BarsInProgress=0 Action=BuyToCover OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=2760.6 SignalName='shortstoplossorentry2' FromEntrySignal='shortentry2'
          t0 15-Jan-24 11:03:00 - t1 15-Jan-24 11:10:00 - conditionshort True - conditionlong False - marketposition Short
          t0 15-Jan-24 11:03:00 - t1 15-Jan-24 11:20:00 - conditionshort True - conditionlong False - marketposition Short
          t0 15-Jan-24 11:03:00 - t1 15-Jan-24 11:30:00 - conditionshort True - conditionlong False - marketposition Short
          t0 15-Jan-24 11:03:00 - t1 15-Jan-24 11:40:00 - conditionshort True - conditionlong False - marketposition Short
          t0 15-Jan-24 11:03:00 - t1 15-Jan-24 11:50:00 - conditionshort True - conditionlong False - marketposition Short
          t0 15-Jan-24 11:03:00 - t1 15-Jan-24 12:00:00 - conditionshort True - conditionlong False - marketposition Short
          t0 15-Jan-24 11:03:00 - t1 15-Jan-24 12:10:00 - conditionshort True - conditionlong False - marketposition Short
          t0 15-Jan-24 11:03:00 - t1 15-Jan-24 12:20:00 - conditionshort True - conditionlong False - marketposition Short
          t0 15-Jan-24 11:03:00 - t1 15-Jan-24 12:30:00 - conditionshort True - conditionlong False - marketposition Short​




          and it is a similar stort on all bar sizes: 53, 73, 93 minutes, everything i have tested.
          Last edited by rtwave; 01-29-2024, 08:11 PM.

          Comment


            #20







            i just created a variation of strategy c where all the commands that involve time have been disabled.



            and this version will also display some unexpected behavior right around 09:30 hours.




            t0 18-Jan-24 07:57:00 - t1 18-Jan-24 08:00:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 07:57:00 - t1 18-Jan-24 08:10:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 07:57:00 - t1 18-Jan-24 08:20:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 07:57:00 - t1 18-Jan-24 08:30:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 07:57:00 - t1 18-Jan-24 08:40:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 07:57:00 - t1 18-Jan-24 08:50:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 07:57:00 - t1 18-Jan-24 09:00:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 07:57:00 - t1 18-Jan-24 09:10:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 07:57:00 - t1 18-Jan-24 09:20:00 - conditionshort False - conditionlong True - marketposition Long
            18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 09:30:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='shortentry1' FromEntrySignal=''
            18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 09:30:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='shortentry2' FromEntrySignal=''
            t0 18-Jan-24 09:30:00 - t1 18-Jan-24 09:30:00 - conditionshort True - conditionlong False - marketposition Long
            18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00232-86150' account='Backtest' name='longstoplossorentry1' orderState=Working instrument='RTY 03-24' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=1136.9 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-18 07:57:00' gtd='2099-12-01' statementDate='2024-01-29'
            18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00233-86150' account='Backtest' name='longstoplossorentry2' orderState=Working instrument='RTY 03-24' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=1136.9 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-18 07:57:00' gtd='2099-12-01' statementDate='2024-01-29'
            18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 09:30:00: BarsInProgress=0 Action=BuyToCover OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=2736.4 SignalName='shortstoplossorentry1' FromEntrySignal='shortentry1'
            18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 09:30:00: BarsInProgress=0 Action=BuyToCover OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=2736.4 SignalName='shortstoplossorentry2' FromEntrySignal='shortentry2'
            t0 18-Jan-24 09:30:00 - t1 18-Jan-24 09:40:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 09:30:00 - t1 18-Jan-24 09:50:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 09:30:00 - t1 18-Jan-24 10:00:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 09:30:00 - t1 18-Jan-24 10:10:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 09:30:00 - t1 18-Jan-24 10:20:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 09:30:00 - t1 18-Jan-24 10:30:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 09:30:00 - t1 18-Jan-24 10:40:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 09:30:00 - t1 18-Jan-24 10:50:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 09:30:00 - t1 18-Jan-24 11:00:00 - conditionshort True - conditionlong False - marketposition Short​




            the positions and the condition do match before and after 09:30 hours, however, the miss at 09:30 hours and all the redundant orders and checks are hard to make sense of. ¿what can nt comment in this case?



            at other times the conditions and positions will be alternated using fewer orders and cancellations as in the case below. so this is a situation to take note of.



            t0 18-Jan-24 12:36:00 - t1 18-Jan-24 12:40:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 12:36:00 - t1 18-Jan-24 12:50:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 12:36:00 - t1 18-Jan-24 13:00:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 12:36:00 - t1 18-Jan-24 13:10:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 12:36:00 - t1 18-Jan-24 13:20:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 12:36:00 - t1 18-Jan-24 13:30:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 12:36:00 - t1 18-Jan-24 13:40:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 12:36:00 - t1 18-Jan-24 13:50:00 - conditionshort True - conditionlong False - marketposition Short
            t0 18-Jan-24 12:36:00 - t1 18-Jan-24 14:00:00 - conditionshort True - conditionlong False - marketposition Short
            18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 14:09:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry1' FromEntrySignal=''
            18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 14:09:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry2' FromEntrySignal=''
            18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00247-86150' account='Backtest' name='shortstoplossorentry1' orderState=Working instrument='RTY 03-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=2715.8 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-18 12:36:00' gtd='2099-12-01' statementDate='2024-01-29'
            18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00248-86150' account='Backtest' name='shortstoplossorentry2' orderState=Working instrument='RTY 03-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=2715.8 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-18 12:36:00' gtd='2099-12-01' statementDate='2024-01-29'
            18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 14:09:00: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=1122.3 SignalName='longstoplossorentry1' FromEntrySignal='longentry1'
            18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 14:09:00: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=1122.3 SignalName='longstoplossorentry2' FromEntrySignal='longentry2'
            t0 18-Jan-24 14:09:00 - t1 18-Jan-24 14:10:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 14:09:00 - t1 18-Jan-24 14:20:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 14:09:00 - t1 18-Jan-24 14:30:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 14:09:00 - t1 18-Jan-24 14:40:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 14:09:00 - t1 18-Jan-24 14:50:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 14:09:00 - t1 18-Jan-24 15:00:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 14:09:00 - t1 18-Jan-24 15:10:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 14:09:00 - t1 18-Jan-24 15:20:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 14:09:00 - t1 18-Jan-24 15:30:00 - conditionshort False - conditionlong True - marketposition Long
            t0 18-Jan-24 14:09:00 - t1 18-Jan-24 15:40:00 - conditionshort False - conditionlong True - marketposition Long​
            Attached Files
            Last edited by rtwave; 01-29-2024, 08:13 PM.

            Comment


              #21
              Hello rtwave,

              Thanks for your response.

              Please keep in mind that in the support department at NinjaTrader, we do not offer hands-on debugging assistance. Through email or on the forum we are happy to answer any questions you may have about NinjaScript. We are also happy to assist with finding resources in our help guide as well as simple examples, and we are happy to assist with guiding you through the debugging process to assist you with understanding unexpected behavior. I have been requesting additional prints as a way of guiding you through the debugging process and getting all of the relevant information to understand your strategy's behavior.

              If you would like more hands-on assistance, you can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our NinjaTrader Ecosystem team to follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request or provide one-on-one educational services.​


              I do not see what is different about the behavior at 9:30 vs.the example you provided at 14:09. You stated that "the positions and the condition do match before and after 09:30 hours, however, the miss at 09:30 hours and all the redundant orders and checks are hard to make sense of. ¿what can nt comment in this case?

              at other times the conditions and positions will be alternated using fewer orders and cancellations as in the case below. so this is a situation to take note of.​"

              What miss at 09:30 are you referring to, and which redundant orders and checks? Both of the scenarios you provided output for have 6 different updates:
              1. shortentry1 is submitted:
                • 18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 09:30:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='shortentry1' FromEntrySignal=''
              2. shortentry2 is submitted:
                • 18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 09:30:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='shortentry2' FromEntrySignal=''
              3. longstoplossorentry1 gets canceled:
                • 18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00232-86150' account='Backtest' name='longstoplossorentry1' orderState=Working instrument='RTY 03-24' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=1136.9 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-18 07:57:00' gtd='2099-12-01' statementDate='2024-01-29'
              4. longstoplossorentry2 gets canceled:
                • 18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00233-86150' account='Backtest' name='longstoplossorentry2' orderState=Working instrument='RTY 03-24' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=1136.9 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-18 07:57:00' gtd='2099-12-01' statementDate='2024-01-29'
              5. shortstoplossorentry1 is submitted:
                • 18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 09:30:00: BarsInProgress=0 Action=BuyToCover OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=2736.4 SignalName='shortstoplossorentry1' FromEntrySignal='shortentry1'
              6. shortstoplossorentry2 is submitted:
                • 18-Jan-24 09:30:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 09:30:00: BarsInProgress=0 Action=BuyToCover OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=2736.4 SignalName='shortstoplossorentry2' FromEntrySignal='shortentry2'

              The same number of "orders and cancellations" happened at 14:09 as well:
              1. ​longentry1 is submitted:
                • 18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 14:09:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry1' FromEntrySignal=''
              2. longentry2 is submitted:
                • 18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 14:09:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry2' FromEntrySignal=''
              3. shortstoplossorentry1 is canceled:
                • 18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00247-86150' account='Backtest' name='shortstoplossorentry1' orderState=Working instrument='RTY 03-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=2715.8 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-18 12:36:00' gtd='2099-12-01' statementDate='2024-01-29'
              4. shortstoplossorentry2 is canceled:
                • 18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00248-86150' account='Backtest' name='shortstoplossorentry2' orderState=Working instrument='RTY 03-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=2715.8 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-18 12:36:00' gtd='2099-12-01' statementDate='2024-01-29'
              5. longstoplossorentry1 is submitted:
                • 18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 14:09:00: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=1122.3 SignalName='longstoplossorentry1' FromEntrySignal='longentry1'
              6. longstoplossorentry2 is submitted:
                • 18-Jan-24 14:09:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 18-Jan-24 14:09:00: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=1122.3 SignalName='longstoplossorentry2' FromEntrySignal='longentry2'​
              At this point, I do not understand what you are considering to be unexpected behavior. To better understand and assist you, please describe what behavior you expected from the strategy vs. the behavior that occurred. Once I understand what behavior you are referring to, I will gladly offer you the next steps in the debugging process though ultimately it is still up to you to perform the testing and debugging to understand your strategy's behavior.

              Thank you for your time and patience.
              Emily C.NinjaTrader Customer Service

              Comment


                #22




                people with nt, NinjaTrader_Emily,



                i have developed several strategies on nt which exhibit good performance. however, to be able to trade them with real funds it is necessary to have these strategies hold positions only during day trading margin hours. that's why i want to use a secondary series with smaller bar sizes to have these strategies enter and exit positions only during day trading margin hours, and there's really no margin for error on anything related to margins.


                guidance from nt is indispensable to be able to develop reliable time filters and even working samples would not be too much to ask for in my opinion.



                i created some very simple sample strategies and the latest version just consists of code to alternate positions and conditions from odd to even bars. the latest test i have performed is on 103 minute bars with 10 minute bars as secondary series as has been the case previously. below i post only the statements related to the variables and market position.



                t0 22-Jan-24 04:18:00 - t1 22-Jan-24 04:20:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 04:18:00 - t1 22-Jan-24 04:30:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 04:18:00 - t1 22-Jan-24 04:40:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 04:18:00 - t1 22-Jan-24 04:50:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 04:18:00 - t1 22-Jan-24 05:00:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 04:18:00 - t1 22-Jan-24 05:10:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 04:18:00 - t1 22-Jan-24 05:20:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 04:18:00 - t1 22-Jan-24 05:30:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 04:18:00 - t1 22-Jan-24 05:40:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 04:18:00 - t1 22-Jan-24 05:50:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 04:18:00 - t1 22-Jan-24 06:00:00 - conditionshort False - conditionlong True - marketposition Long​

                t0 22-Jan-24 06:01:00 - t1 22-Jan-24 06:10:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 06:01:00 - t1 22-Jan-24 06:20:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 06:01:00 - t1 22-Jan-24 06:30:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 06:01:00 - t1 22-Jan-24 06:40:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 06:01:00 - t1 22-Jan-24 06:50:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 06:01:00 - t1 22-Jan-24 07:00:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 06:01:00 - t1 22-Jan-24 07:10:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 06:01:00 - t1 22-Jan-24 07:20:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 06:01:00 - t1 22-Jan-24 07:30:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 06:01:00 - t1 22-Jan-24 07:40:00 - conditionshort True - conditionlong False - marketposition Short​

                t0 22-Jan-24 07:44:00 - t1 22-Jan-24 07:50:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 07:44:00 - t1 22-Jan-24 08:00:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 07:44:00 - t1 22-Jan-24 08:10:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 07:44:00 - t1 22-Jan-24 08:20:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 07:44:00 - t1 22-Jan-24 08:30:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 07:44:00 - t1 22-Jan-24 08:40:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 07:44:00 - t1 22-Jan-24 08:50:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 07:44:00 - t1 22-Jan-24 09:00:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 07:44:00 - t1 22-Jan-24 09:10:00 - conditionshort False - conditionlong True - marketposition Long
                t0 22-Jan-24 07:44:00 - t1 22-Jan-24 09:20:00 - conditionshort False - conditionlong True - marketposition Long​

                t0 22-Jan-24 09:27:00 - t1 22-Jan-24 09:30:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 09:27:00 - t1 22-Jan-24 09:40:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 09:27:00 - t1 22-Jan-24 09:50:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 09:27:00 - t1 22-Jan-24 10:00:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 09:27:00 - t1 22-Jan-24 10:10:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 09:27:00 - t1 22-Jan-24 10:20:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 09:27:00 - t1 22-Jan-24 10:30:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 09:27:00 - t1 22-Jan-24 10:40:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 09:27:00 - t1 22-Jan-24 10:50:00 - conditionshort True - conditionlong False - marketposition Short
                t0 22-Jan-24 09:27:00 - t1 22-Jan-24 11:00:00 - conditionshort True - conditionlong False - marketposition Short​


                up to this point, i understand the strategy is behaving exactly as intended. the condition variables and market position are always in synchrony.


                22-Jan-24 11:10:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 22-Jan-24 11:10:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry1' FromEntrySignal=''
                22-Jan-24 11:10:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 22-Jan-24 11:10:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='longentry2' FromEntrySignal=''
                t0 22-Jan-24 11:10:00 - t1 22-Jan-24 11:10:00 - conditionshort False - conditionlong True - marketposition Short
                22-Jan-24 11:10:00 Strategy 'sampletimefilters1cnofilters/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00017-126494' account='Backtest' name='shortstoplossorentry1' orderState=Working instrument='RTY 03-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=2774.2 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-22 09:27:00' gtd='2099-12-01' statementDate='2024-01-31'
                22-Jan-24 11:10:00 Strategy 'sampletimefilters1cnofilters/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00018-126494' account='Backtest' name='shortstoplossorentry2' orderState=Working instrument='RTY 03-24' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=2774.2 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2024-01-22 09:27:00' gtd='2099-12-01' statementDate='2024-01-31'
                22-Jan-24 11:10:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 22-Jan-24 11:10:00: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=1185.1 SignalName='longstoplossorentry1' FromEntrySignal='longentry1'
                22-Jan-24 11:10:00 Strategy 'sampletimefilters1cnofilters/-1': Entered internal SubmitOrderManaged() method at 22-Jan-24 11:10:00: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=1185.1 SignalName='longstoplossorentry2' FromEntrySignal='longentry2'



                then at 11:10 seemingly bars for the two series happen to close at the same time and then orders and cancellations are reported in a slightly different order. i don't know how to interpret these lines and i'm just trying to make sense of what could be happening.



                most importantly, the print triggered by the secondary series at 11:10 reports that conditionshort is false, conditionlong is true and still market position is short.


                t0 22-Jan-24 11:10:00 - t1 22-Jan-24 11:10:00 - conditionshort False - conditionlong True - marketposition Short


                i understand this is a miss and call it a miss because the objective for this strategy is to always keep the private binary variables and market position synchronized. after this particular moment, conditions and positions coincide for the rest of the day.


                in this test with 103 minute bars this situation is reported at 11:10, in my previous post with 93 minute bar size, an identical situation was reported at 09:30.


                t0 18-Jan-24 09:30:00 - t1 18-Jan-24 09:30:00 - conditionshort True - conditionlong False - marketposition Long


                i now see that this seems to occur when the bars for the two series coincide, which is not frequent because i'm using bar sizes that prevent this from happening.


                and being that i'm just learning how to create, compile and interpret prints it is that i asked nt for commentary on this occurrence that i consider to be unexpected. and in the end it could be that everything is just a discrepancy and the strategy is indeed alternating conditions and positions in synchrony but the print generated by the secondary series is produced before the platform can have the most updated information of the variables and market position.



                i plan to use much faster bar sizes (something like 30 second and 4 second) and then test these strategies on real time data on simulator. then it will be much clearer to tell whether the strategy does keep conditions and positions in synchrony and the prints are confusing or if there is something else going on.

                Last edited by rtwave; 01-31-2024, 02:44 PM.

                Comment


                  #23
                  Hello rtwave,

                  Thanks for your reply.

                  Please add BarsInProgress to your print statements so you may see which data series is calling OnBarUpdate() and generating the prints:


                  What is your logic that toggles conditionshort and conditionlong between true and false? You could also add a print for each time these change between true/false and include BarsInProgress to see when that condition is being triggered. If it is calculated based on the bar index, you could also include CurrentBar in your print to see which bar index for the BarsInProgress is being used at the time the condition is triggered:


                  It may help to review this page about multi-time frame & instrument scripts, particularly the "How Bars Data Is Referenced" section to understand what information is known by each data series based on the Calculate property:


                  Thank you for your time and patience.
                  Emily C.NinjaTrader Customer Service

                  Comment


                    #24




                    people with nt,



                    i have done as i had threatened and ran these sample strategies on real time live data on very fast bar sizes. i have the prints and the order grids so that nt can assist in evaluating whether the time limits are performing as intended.



                    this is the same sample strategy i posted before, i just removed all the commands related to time.


                    if(BarsInProgress == 0)
                    {

                    if (CurrentBar % 2 == 0)
                    {
                    conditionshort = true;
                    conditionlong = false;
                    if ( (Position.MarketPosition != MarketPosition.Short)
                    )
                    {
                    if ( Trade01short == true )
                    {
                    EnterShort(0, Convert.ToInt32(Position1), @"shortentry1");
                    }
                    if ( Trade02short == true )
                    {
                    EnterShort(0, Convert.ToInt32(Position2), @"shortentry2");
                    }
                    }
                    }

                    if (CurrentBar % 2 == 1)
                    {
                    conditionlong = true;
                    conditionshort = false;
                    if ( (Position.MarketPosition != MarketPosition.Long)
                    )
                    {
                    if ( Trade01long == true
                    && Position.MarketPosition != MarketPosition.Long )
                    {
                    EnterLong(0, Convert.ToInt32(Position1), @"longentry1");
                    }
                    if ( Trade02long == true )
                    {
                    EnterLong(0, Convert.ToInt32(Position2), @"longentry2");
                    }
                    }
                    }

                    }
                    else if(BarsInProgress == 1)
                    {

                    Print("t0 " + Times[0][0] + " - t1 " + Times[1][0] + " - conditionshort " + conditionshort + " - conditionlong " + conditionlong + " - marketposition " + Position.MarketPosition );

                    }​



                    i ran the strategy on 30 and 4 second bars. nt would be expected to reverse from short to long every 30 seconds and generate prints every 4 seconds.

                    the order grid looks like this:

                    RTY 03-24,Sell,Stop Market,1,0,1176.9,Cancelled,0,0,1,longstoplossoren try1,sampletimefilters1cnofilters,,GTC,Sim101,d8d4 6ae54cc84e2c9059547d074f39e6,31-Jan-24 15:14:31,,
                    RTY 03-24,Sell short,Market,1,0,0,Filled,1,1975.6,0,shortentry2,s ampletimefilters1cnofilters,,GTC,Sim101,5530df3483 e8428496c1e7915e33864c,31-Jan-24 15:14:31,,
                    RTY 03-24,Sell,Stop Market,1,0,1176.9,Cancelled,0,0,1,longstoplossoren try2,sampletimefilters1cnofilters,,GTC,Sim101,06da c71b94364e96826af339dc9e3b9e,31-Jan-24 15:14:31,,
                    RTY 03-24,Buy to cover,Market,2,0,0,Filled,2,1976.05,0,Close position,sampletimefilters1cnofilters,,GTC,Sim101, 0608bc39c28c49fbb4b2a886bb222869,31-Jan-24 15:16:02,,
                    RTY 03-24,Buy,Market,1,0,0,Filled,1,1976,0,longentry1,,,G TC,Sim101,7bd56e3c97384c2d814320c21d2dea42,31-Jan-24 15:16:02,,
                    RTY 03-24,Buy to cover,Stop Market,1,0,2775.6,Cancelled,0,0,1,shortstoplossore ntry1,sampletimefilters1cnofilters,,GTC,Sim101,5a9 6d1b67a994d1b906b0b028d7ffae1,31-Jan-24 15:16:02,,
                    RTY 03-24,Buy to cover,Stop Market,1,0,2775.6,Cancelled,0,0,1,shortstoplossore ntry2,sampletimefilters1cnofilters,,GTC,Sim101,952 0afebe0934fe3b6ff4927b8eacf6f,31-Jan-24 15:16:02,,
                    RTY 03-24,Buy,Market,1,0,0,Filled,1,1976,0,longentry2,,,G TC,Sim101,fef854fc7f1b401f853a1b205e5eb63f,31-Jan-24 15:16:02,,
                    RTY 03-24,Sell,Market,2,0,0,Filled,2,1976.1,0,Close position,sampletimefilters1cnofilters,,GTC,Sim101, 6d3aeb39fd884d4f91c62a22ea4f2d62,31-Jan-24 15:16:03,,
                    RTY 03-24,Sell short,Market,1,0,0,Filled,1,1976.1,0,shortentry1,s ampletimefilters1cnofilters,,GTC,Sim101,e49f1e9e4b 6c4c738516441805595693,31-Jan-24 15:16:03,,
                    RTY 03-24,Sell,Stop Market,1,0,1176.0,Cancelled,0,0,1,longstoplossoren try1,sampletimefilters1cnofilters,,GTC,Sim101,c13f 474cc65e45b39a818e8fbda99b5f,31-Jan-24 15:16:04,,
                    RTY 03-24,Sell,Stop Market,1,0,1176.0,Cancelled,0,0,1,longstoplossoren try2,,,GTC,Sim101,7d06bae720c04b469885ede97339abf0 ,31-Jan-24 15:16:04,,
                    RTY 03-24,Sell short,Market,1,0,0,Filled,1,1976.1,0,shortentry2,s ampletimefilters1cnofilters,,GTC,Sim101,a6bff17aa8 5c4286afd48a1d19000a5d,31-Jan-24 15:16:04,,
                    RTY 03-24,Buy to cover,Market,2,0,0,Filled,2,1977.85,0,Close position,sampletimefilters1cnofilters,,GTC,Sim101, a7cbfc3e8c064e98a50d9336b5c2eeed,31-Jan-24 15:16:04,,
                    RTY 03-24,Buy,Market,1,0,0,Filled,1,1977.8,0,longentry1,s ampletimefilters1cnofilters,,GTC,Sim101,689bf95dbc 6f406b9870fbc027154238,31-Jan-24 15:16:05,,
                    RTY 03-24,Buy to cover,Stop Market,1,0,2776.1,Cancelled,0,0,1,shortstoplossore ntry1,sampletimefilters1cnofilters,,GTC,Sim101,8b8 c10bcbf4f4388b8aa1b76db29e097,31-Jan-24 15:16:05,,
                    RTY 03-24,Buy to cover,Stop Market,1,0,2776.1,Cancelled,0,0,1,shortstoplossore ntry2,sampletimefilters1cnofilters,,GTC,Sim101,a4a ce492af024904a6c0452589b65203,31-Jan-24 15:16:05,,
                    RTY 03-24,Buy,Market,1,0,0,Filled,1,1977.8,0,longentry2,s ampletimefilters1cnofilters,,GTC,Sim101,4e3d98e738 ed4b31a552c7cbe63d9de8,31-Jan-24 15:16:05,,
                    RTY 03-24,Sell,Market,2,0,0,Filled,2,1976.9,0,Close position,sampletimefilters1cnofilters,,GTC,Sim101, 9555a84a1d7047a2912d01617f54c760,31-Jan-24 15:16:30,,
                    RTY 03-24,Sell short,Market,1,0,0,Filled,1,1976.9,0,shortentry1,s ampletimefilters1cnofilters,,GTC,Sim101,7f63ee3dac 4941479f3faa0db24cb2ad,31-Jan-24 15:16:30,,
                    RTY 03-24,Sell,Stop Market,1,0,1177.8,Cancelled,0,0,1,longstoplossoren try1,sampletimefilters1cnofilters,,GTC,Sim101,a7c0 51d3245b4dbeab0de29fb4f28725,31-Jan-24 15:16:30,,
                    RTY 03-24,Sell,Stop Market,1,0,1177.8,Cancelled,0,0,1,longstoplossoren try2,sampletimefilters1cnofilters,,GTC,Sim101,dc6f da69d13e46ec99916e0cbc88337b,31-Jan-24 15:16:30,,
                    RTY 03-24,Sell short,Market,1,0,0,Filled,1,1976.9,0,shortentry2,s ampletimefilters1cnofilters,,GTC,Sim101,3a4557fa9f e5405e8b1fe94ba3cddaa9,31-Jan-24 15:16:30,,
                    RTY 03-24,Buy to cover,Market,2,0,0,Filled,2,1976.7,0,Close position,sampletimefilters1cnofilters,,GTC,Sim101, 29935191e487453ba7fece0e82bff6ee,31-Jan-24 15:17:00,,
                    RTY 03-24,Buy,Market,1,0,0,Filled,1,1976.7,0,longentry1,s ampletimefilters1cnofilters,,GTC,Sim101,ef8b881ee3 be43369e6d06a334ff00fd,31-Jan-24 15:17:00,,
                    RTY 03-24,Buy to cover,Stop Market,1,0,2776.9,Cancelled,0,0,1,shortstoplossore ntry1,sampletimefilters1cnofilters,,GTC,Sim101,6c3 28054d0b6456c945b084edb6d81c4,31-Jan-24 15:17:00,,
                    RTY 03-24,Buy to cover,Stop Market,1,0,2776.9,Cancelled,0,0,1,shortstoplossore ntry2,sampletimefilters1cnofilters,,GTC,Sim101,c73 0938f6baa473aae1b80ee2636dca0,31-Jan-24 15:17:00,,
                    RTY 03-24,Buy,Market,1,0,0,Filled,1,1976.7,0,longentry2,s ampletimefilters1cnofilters,,GTC,Sim101,813d812961 1649e288059e88908830c1,31-Jan-24 15:17:00,,
                    RTY 03-24,Sell,Market,2,0,0,Filled,2,1978.75,0,Close position,sampletimefilters1cnofilters,,GTC,Sim101, 412b7461c6e34ffca58a00029dd30701,31-Jan-24 15:17:30,,
                    RTY 03-24,Sell short,Market,1,0,0,Filled,1,1978.7,0,shortentry1,s ampletimefilters1cnofilters,,GTC,Sim101,50d5c27b8c 25429896ada3b914756c44,31-Jan-24 15:17:30,,
                    RTY 03-24,Sell,Stop Market,1,0,1176.7,Cancelled,0,0,1,longstoplossoren try1,sampletimefilters1cnofilters,,GTC,Sim101,b001 7e2969ff45cabfa45753efd47d65,31-Jan-24 15:17:30,,
                    RTY 03-24,Sell,Stop Market,1,0,1176.7,Cancelled,0,0,1,longstoplossoren try2,sampletimefilters1cnofilters,,GTC,Sim101,ed66 3a119f5e4026b53d4758a147bf58,31-Jan-24 15:17:30,,
                    RTY 03-24,Sell short,Market,1,0,0,Filled,1,1978.8,0,shortentry2,s ampletimefilters1cnofilters,,GTC,Sim101,7a72c5e053 034d44b486566c267d8878,31-Jan-24 15:17:30,,
                    RTY 03-24,Buy to cover,Stop Market,1,0,2778.7,Accepted,0,0,1,shortstoplossoren try1,sampletimefilters1cnofilters,,GTC,Sim101,5d6f 01168daa4f539fb429061f0088f6,31-Jan-24 15:17:30,,
                    RTY 03-24,Buy to cover,Stop Market,1,0,2778.8,Accepted,0,0,1,shortstoplossoren try2,sampletimefilters1cnofilters,,GTC,Sim101,ba71 746062ab4dcb8cee075746c22873,31-Jan-24 15:17:30,,
                    RTY 03-24,Buy to cover,Market,2,0,0,Submitted,2,0,0,Close position,sampletimefilters1cnofilters,,GTC,Sim101, ed8bfe9aaee1484e89ac330620079ec0,31-Jan-24 15:18:00,,
                    RTY 03-24,Buy,Market,1,0,0,Submitted,1,0,0,longentry1,sam pletimefilters1cnofilters,,GTC,Sim101,5853c9c63918 4729a5ccf217660f74d6,31-Jan-24 15:18:00,,
                    RTY 03-24,Buy,Market,1,0,0,Submitted,1,0,0,longentry2,sam pletimefilters1cnofilters,,GTC,Sim101,cbe5ad2b5c36 4e9c84a206423a226e42,31-Jan-24 15:18:00,,
                    RTY 03-24,Sell,Stop Market,1,0,1177.1,Submitted,0,0,1,longstoplossoren try1,sampletimefilters1cnofilters,,GTC,Sim101,c4e5 b8e214304d6f92ec23d1d05240d8,31-Jan-24 15:18:00,,
                    RTY 03-24,Sell,Stop Market,1,0,1177.1,Submitted,0,0,1,longstoplossoren try2,sampletimefilters1cnofilters,,GTC,Sim101,de79 cfc125444b0c9dd81c35206020e4,31-Jan-24 15:18:00,,​



                    the logs are more extensive but i have shared the file for anyone to consult.


                    i would say that this pure position alternating strategy does indeed perform as intended, ¿does nt concur?
                    Attached Files

                    Comment


                      #25


                      continuing.



                      the second test was performed with sample strategy c that i posted some days ago.



                      same as in the previous post, i used 30 and 4 second bars. the start and end times for positions were 15:22 and 15:26 if i'm not mistaken. i attach all files, including the strategy once again.


                      the order grid looks like this.


                      Instrument,Action,Type,Quantity,Limit,Stop,State,F illed,Avg. price,Remaining,Name,Strategy,OCO,TIF,Account display name,ID,Time,Cancel,
                      RTY 03-24,Sell,Market,2,0,0,Filled,2,1979.15,0,Close position,sampletimefilters1c,,GTC,Sim101,57bcd89aa 0ab43f89bf4f3f210d7a555,31-Jan-24 15:22:30,,
                      RTY 03-24,Sell,Stop Market,1,0,1177.7,Cancelled,0,0,1,longstoplossoren try2,sampletimefilters1c,,GTC,Sim101,dc70d8c829af4 3ed8d14ddec0ca7ed37,31-Jan-24 15:22:31,,
                      RTY 03-24,Sell,Stop Market,1,0,1177.7,Cancelled,0,0,1,longstoplossoren try1,,,GTC,Sim101,ab0f879110f54429ae2fa032ed1d1481 ,31-Jan-24 15:22:31,,
                      RTY 03-24,Sell short,Market,1,0,0,Filled,1,1979.2,0,shortentry1,s ampletimefilters1c,,GTC,Sim101,bc4fd46bc466476180d 8df5b7281f753,31-Jan-24 15:22:31,,
                      RTY 03-24,Sell short,Market,1,0,0,Filled,1,1979.2,0,shortentry2,, ,GTC,Sim101,76dcaaf66876494ba1d5d4704da675e4,31-Jan-24 15:22:31,,
                      RTY 03-24,Buy to cover,Market,2,0,0,Filled,2,1979.8,0,Close position,sampletimefilters1c,,GTC,Sim101,20ed24065 2ed4a3ca2085b64025806a9,31-Jan-24 15:23:00,,
                      RTY 03-24,Buy,Market,1,0,0,Filled,1,1979.8,0,longentry1,s ampletimefilters1c,,GTC,Sim101,a2212d0740a445c4a98 77ce04d608e66,31-Jan-24 15:23:00,,
                      RTY 03-24,Buy to cover,Stop Market,1,0,2779.2,Cancelled,0,0,1,shortstoplossore ntry1,,,GTC,Sim101,a5eb8f1a3e2a49489681342b001339b 4,31-Jan-24 15:23:00,,
                      RTY 03-24,Buy to cover,Stop Market,1,0,2779.2,Cancelled,0,0,1,shortstoplossore ntry2,,,GTC,Sim101,67af4c31f14e470899ea8861eecc2f5 5,31-Jan-24 15:23:00,,
                      RTY 03-24,Buy,Market,1,0,0,Filled,1,1979.8,0,longentry2,s ampletimefilters1c,,GTC,Sim101,b03997405720455ab4a 5a1897934f8ba,31-Jan-24 15:23:00,,
                      RTY 03-24,Sell,Market,2,0,0,Filled,2,1978.4,0,Close position,,,GTC,Sim101,e337eecfd5d3433a81ae6219382e 6591,31-Jan-24 15:23:30,,
                      RTY 03-24,Sell short,Market,1,0,0,Filled,1,1978.4,0,shortentry1,s ampletimefilters1c,,GTC,Sim101,77a23b7832894edcb43 9a2242f0eea2d,31-Jan-24 15:23:30,,
                      RTY 03-24,Sell,Stop Market,1,0,1179.8,Cancelled,0,0,1,longstoplossoren try1,,,GTC,Sim101,1f096d2ea9434c9593528edab1125d60 ,31-Jan-24 15:23:30,,
                      RTY 03-24,Sell short,Market,1,0,0,Filled,1,1978.4,0,shortentry2,s ampletimefilters1c,,GTC,Sim101,d96011446f3545dcb04 6d41935c7c6e9,31-Jan-24 15:23:30,,
                      RTY 03-24,Sell,Stop Market,1,0,1179.8,Cancelled,0,0,1,longstoplossoren try2,sampletimefilters1c,,GTC,Sim101,2823626d30f34 eb4b6db086ee157c0c2,31-Jan-24 15:23:30,,
                      RTY 03-24,Buy to cover,Market,2,0,0,Filled,2,1980.15,0,Close position,sampletimefilters1c,,GTC,Sim101,6d0a1717f 7244a16a1f2019676696c11,31-Jan-24 15:24:00,,
                      RTY 03-24,Buy,Market,1,0,0,Filled,1,1980.1,0,longentry1,s ampletimefilters1c,,GTC,Sim101,87bcf1a2ea2c479f862 a1cea7a2e2f76,31-Jan-24 15:24:00,,
                      RTY 03-24,Buy to cover,Stop Market,1,0,2778.4,Cancelled,0,0,1,shortstoplossore ntry1,sampletimefilters1c,,GTC,Sim101,1374dbbb8e71 4b6da73bc7b559fbc610,31-Jan-24 15:24:00,,
                      RTY 03-24,Buy to cover,Stop Market,1,0,2778.4,Cancelled,0,0,1,shortstoplossore ntry2,sampletimefilters1c,,GTC,Sim101,3abe89aab6b2 4c92ad57a993f12879c7,31-Jan-24 15:24:00,,
                      RTY 03-24,Buy,Market,1,0,0,Filled,1,1980.1,0,longentry2,s ampletimefilters1c,,GTC,Sim101,108192c9f739426ab95 f18b56be71b69,31-Jan-24 15:24:00,,
                      RTY 03-24,Sell,Market,2,0,0,Filled,2,1979.7,0,Close position,sampletimefilters1c,,GTC,Sim101,e7216ff44 69c42808749a5d77a197b4f,31-Jan-24 15:24:30,,
                      RTY 03-24,Sell short,Market,1,0,0,Filled,1,1979.6,0,shortentry2,s ampletimefilters1c,,GTC,Sim101,0b24d2f2c8564444bfe 3c79eac20e863,31-Jan-24 15:24:30,,
                      RTY 03-24,Sell,Stop Market,1,0,1180.1,Cancelled,0,0,1,longstoplossoren try1,sampletimefilters1c,,GTC,Sim101,a4bbb15d8ba54 97c8616d6b3ce24253e,31-Jan-24 15:24:30,,
                      RTY 03-24,Sell,Stop Market,1,0,1180.1,Cancelled,0,0,1,longstoplossoren try2,sampletimefilters1c,,GTC,Sim101,b2a7ba19f0104 ea4ab431a39a4f3e541,31-Jan-24 15:24:30,,
                      RTY 03-24,Sell short,Market,1,0,0,Filled,1,1979.2,0,shortentry1,s ampletimefilters1c,,GTC,Sim101,dcf8b026ea684ce8a6f 0f3c0648bcb84,31-Jan-24 15:24:30,,
                      RTY 03-24,Buy to cover,Market,2,0,0,Filled,2,1977.2,0,Close position,sampletimefilters1c,,GTC,Sim101,0430f71ba 5794a6980df0705643dcfde,31-Jan-24 15:25:00,,
                      RTY 03-24,Buy,Market,1,0,0,Filled,1,1977.2,0,longentry1,s ampletimefilters1c,,GTC,Sim101,b90b66d08cd34ee88e4 9d7d5e8a2b7a5,31-Jan-24 15:25:00,,
                      RTY 03-24,Buy to cover,Stop Market,1,0,2779.6,Cancelled,0,0,1,shortstoplossore ntry2,sampletimefilters1c,,GTC,Sim101,fddfca8dc43d 4bb6836155fa6386231a,31-Jan-24 15:25:00,,
                      RTY 03-24,Buy to cover,Stop Market,1,0,2779.2,Cancelled,0,0,1,shortstoplossore ntry1,sampletimefilters1c,,GTC,Sim101,3282cb7825af 4e8eb3a698ac64603544,31-Jan-24 15:25:00,,
                      RTY 03-24,Buy,Market,1,0,0,Filled,1,1977.2,0,longentry2,s ampletimefilters1c,,GTC,Sim101,4fc94bf151c24b17ada c2de77be1ce13,31-Jan-24 15:25:00,,
                      RTY 03-24,Sell,Market,2,0,0,Filled,2,1975.7,0,Close position,sampletimefilters1c,,GTC,Sim101,a04cb9b25 cea4cef90aea7ac11786f63,31-Jan-24 15:25:30,,
                      RTY 03-24,Sell short,Market,1,0,0,Filled,1,1975.7,0,shortentry1,s ampletimefilters1c,,GTC,Sim101,19200d1823304e63ac7 3860f7aa36128,31-Jan-24 15:25:30,,
                      RTY 03-24,Sell,Stop Market,1,0,1177.2,Cancelled,0,0,1,longstoplossoren try1,sampletimefilters1c,,GTC,Sim101,d8bfcb109a124 a48a7b7679b5eabf234,31-Jan-24 15:25:30,,
                      RTY 03-24,Sell short,Market,1,0,0,Filled,1,1975.7,0,shortentry2,s ampletimefilters1c,,GTC,Sim101,cd8a2fceed904293a56 d8ca8242db567,31-Jan-24 15:25:30,,
                      RTY 03-24,Sell,Stop Market,1,0,1177.2,Cancelled,0,0,1,longstoplossoren try2,sampletimefilters1c,,GTC,Sim101,df7045f2102f4 102b4cbeadfe5c461e8,31-Jan-24 15:25:30,,
                      RTY 03-24,Buy to cover,Market,1,0,0,Filled,1,1973.9,0,shcltiexorent ry1,sampletimefilters1c,,GTC,Sim101,654356f8bdc14f 47bb6cb30d67899926,31-Jan-24 15:26:00,,
                      RTY 03-24,Buy to cover,Market,1,0,0,Filled,1,1973.8,0,shcltiexorent ry2,sampletimefilters1c,,GTC,Sim101,4bf41e11d73e4d e89df362f3006d3fa8,31-Jan-24 15:26:00,,
                      RTY 03-24,Buy to cover,Stop Market,1,0,2775.7,Cancelled,0,0,1,shortstoplossore ntry1,sampletimefilters1c,,GTC,Sim101,62133a6241bf 454ab6050af661ff3697,31-Jan-24 15:26:00,,
                      RTY 03-24,Buy to cover,Stop Market,1,0,2775.7,Cancelled,0,0,1,shortstoplossore ntry2,sampletimefilters1c,,GTC,Sim101,d933aecffba2 4d0c8452dfb193160746,31-Jan-24 15:26:00,,



                      the logs are too extensive to post, but i have attached the file.



                      ¿what would nt's veredict be in this case? is the strategy alternating positions and following time limits as is intended?

                      ¿could i consider this to be a reliable template to work with if i use larger bar sizes like 4 and 1 minute bars?
                      Attached Files

                      Comment


                        #26
                        Hello rtwave,

                        Thanks for your reply.

                        Yes, based on the output attachment it does seem that there are long/short orders alternating every 30 seconds. It is ultimately up to you to decide if this is performing "as intended" since you are the one developing the strategy and writing the logic. Through testing, you can determine if the strategy is behaving how you expected it to based on how you wrote it or if it is not behaving as expected, which would mean you need to debug the unexpected behavior to locate the cause and identify a resolution.
                        Emily C.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Haiasi, 04-25-2024, 06:53 PM
                        2 responses
                        16 views
                        0 likes
                        Last Post Massinisa  
                        Started by Creamers, Today, 05:32 AM
                        0 responses
                        4 views
                        0 likes
                        Last Post Creamers  
                        Started by Segwin, 05-07-2018, 02:15 PM
                        12 responses
                        1,785 views
                        0 likes
                        Last Post Leafcutter  
                        Started by poplagelu, Today, 05:00 AM
                        0 responses
                        3 views
                        0 likes
                        Last Post poplagelu  
                        Started by fx.practic, 10-15-2013, 12:53 AM
                        5 responses
                        5,407 views
                        0 likes
                        Last Post Bidder
                        by Bidder
                         
                        Working...
                        X