Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer

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

    Strategy Analyzer

    It looks like I have to write CurrentBars[1] >= BarsRequiredToTrade too
    if I don't write it, it won't bring the error that the index is out of range but this error:
    'An order placed at '...' has been ignored since the order was submitted before the strategy property BarsRequiredToTrade had been met' but the backtest works fine anyway, so it's just a cosmetical error.

    The other thing I noticed is: I ported a strategy of mine from NT7 to NT8 and if I test at the Forex (EURUSD) I get an other result as I get in NT7
    I deleted my data in NT7 to get the same data as I have in NT8 but still the same difference in my results.

    Anyone else who noticed this at the forex or at any other market ?


    Best Regards
    Sascha
    msa-systems_Sascha
    NinjaTrader Ecosystem Vendor - MSA Systems

    #2
    If your BarsRequiredToTrade is set to 20 for example, but you have a Trade that is attempted to be placed before that current bar's value, the error would be expected. You need to add runtime handling if you wish to suppress the error, reduce the bars required to trade, or simply ignore the error:

    Regarding the Forex, what are you pip settings in NT7? Do you have it set to full, half or tenth pip? What provider are you using in NT8?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Hey Matthew,
      So the error is no error .. it's a hint ?
      It's just a bit confusing if I say I want to start trading after 20 Bars and I get an error because it were be possible to trade earlier (first I thought u changed the BarsRequiredToTrade to a normal variable so that the value there doesn't matter at all anymore)

      My pip setting in NT7 is tenth pip, provider is FXCM
      msa-systems_Sascha
      NinjaTrader Ecosystem Vendor - MSA Systems

      Comment


        #4
        Hello,

        I'll be happy to take a look at what may be causing the discrepancy with your ported code. You can please provide me with a snippet of code showing your order entry and exit logic? Also, does this issue show up in backtesting, live deployment, or both? This will allow me to approximate what you are doing on my side to see if I run into the same issue.

        I look forward to your reply.
        Dave I.NinjaTrader Product Management

        Comment


          #5
          Originally posted by msa-systems_Sascha View Post
          Hey Matthew,
          So the error is no error .. it's a hint ?
          It's just a bit confusing if I say I want to start trading after 20 Bars and I get an error because it were be possible to trade earlier (first I thought u changed the BarsRequiredToTrade to a normal variable so that the value there doesn't matter at all anymore)

          Not sure what you mean - that value/requirement has not changed from NinjaTrader 7 to NinjaTrader 8. The only thing that changed was the name.

          It would only bit hit if you tried to use a submit method (EnterLong/EnterShort, etc) when the current bar is less than 20 by default. If your strategy does not have N bars required to trade, you can set that value to 0 in State.SetDefautls

          Code:
          			if (State == State.SetDefaults)
          			{
          				BarsRequiredToTrade = 0;
          			}
          MatthewNinjaTrader Product Management

          Comment


            #6
            Hey,
            Sorry for the late reply.
            In regards to BarsRequiredToTrade:
            In Ninjatrader7 I write in the initialize section BarsRequired = X and then I can only trade if there are already X Bars and I won't get an error / hint which looks like an error in the log which tells me that it were be possible to trade earlier.
            In Ninjatrader 8 I write in the State.SetDefaults area BarsRequiredToTrade = X and then I would get an error / hint that it were be possible to trade earlier. I don't get this error / hint if I write in the OnBarUpdate area if(CurrentBars[x] > BarsRequiredToTrade)
            So the question is what's the point of having BarsRequiredToTrade in the SetDefaults state if it won't affect anything.

            In regards of the problem with the Strategy Analyzer:
            I noticed in other systems too(doesn't matter which market) that if I have a limit (target) and a stopmarket (stop) if the trade is positive and hits my target, my target will get filled and the stop cancelled. (so this scenario works fine)
            If my trade will hit the stop my target will get cancelled but the stop will get filled twice attached u will see the chart from a backtest where my stop will get filled twice. (there is no order for the second stop!) attached u will also find a picture from the orders.


            Best regards
            Sascha
            Attached Files
            msa-systems_Sascha
            NinjaTrader Ecosystem Vendor - MSA Systems

            Comment


              #7
              Originally posted by msa-systems_Sascha View Post

              In regards of the problem with the Strategy Analyzer:
              I noticed in other systems too(doesn't matter which market) that if I have a limit (target) and a stopmarket (stop) if the trade is positive and hits my target, my target will get filled and the stop cancelled. (so this scenario works fine)
              If my trade will hit the stop my target will get cancelled but the stop will get filled twice attached u will see the chart from a backtest where my stop will get filled twice. (there is no order for the second stop!) attached u will also find a picture from the orders.


              Best regards
              Sascha

              I have the same problem with my startegy in strategy analyzer, but this strategy in live works in the coorect way. I have this error only with the unmanaged target order, with the stop no. In nt7 it is correct!
              the code of the target is:
              targetOrder = SubmitOrderUnmanaged( 0, OrderAction.Sell, OrderType.Limit, 1, target , target, "", "LongTarget" );
              Attached Files

              Comment


                #8
                Thank you guys for sharing that info -- Sascha, it looks like you are only seeing one fill in the Orders display of the Strategy Analyzer, but you see two order plots on the chart. Are you finding that the Strategy Analyzer is indeed only filling the order once, but printing it twice on the chart, or is there something else that shows that the order was actually filled twice?

                Mirkocero -- do you see the same thing as Sascha's screenshot, where you only see one fill in the Orders display, but you see two fills printed on the chart?
                Dave I.NinjaTrader Product Management

                Comment


                  #9
                  Originally posted by NinjaTrader_Dave View Post

                  Mirkocero -- do you see the same thing as Sascha's screenshot, where you only see one fill in the Orders display, but you see two fills printed on the chart?

                  I look one fill in orders display and in the execution too. But in the target order is filled and reerse the position. I attach another screenshots that show this.
                  Attached Files

                  Comment


                    #10
                    True, in the executions Tab I see the second fill but in the order tab I didn't see it.
                    In the chart u see the second fill and it's not just a graphical bug.
                    After this you have a position in the other direction.

                    So in my backtest I will have trades till my stop gets filled then I have an unhandled short position without target and stop, so I have a short position all time. (surely I will get kicked at the end of the chart with 'exit on close' )


                    Best regards
                    Sascha
                    msa-systems_Sascha
                    NinjaTrader Ecosystem Vendor - MSA Systems

                    Comment


                      #11
                      Originally posted by msa-systems_Sascha View Post
                      True, in the executions Tab I see the second fill but in the order tab I didn't see it.
                      In the chart u see the second fill and it's not just a graphical bug.
                      After this you have a position in the other direction.

                      So in my backtest I will have trades till my stop gets filled then I have an unhandled short position without target and stop, so I have a short position all time. (surely I will get kicked at the end of the chart with 'exit on close' )


                      Best regards
                      Sascha
                      Ok, thank you. I'm going to recreate the scenario you described in post #6 on this thread to see if I can capture the issue happening on my end and submit a QA report.
                      Dave I.NinjaTrader Product Management

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by sidlercom80, 10-28-2023, 08:49 AM
                      167 responses
                      2,260 views
                      0 likes
                      Last Post jeronymite  
                      Started by warreng86, 11-10-2020, 02:04 PM
                      7 responses
                      1,362 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by Perr0Grande, Today, 08:16 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post Perr0Grande  
                      Started by elderan, Today, 08:03 PM
                      0 responses
                      9 views
                      0 likes
                      Last Post elderan
                      by elderan
                       
                      Started by algospoke, Today, 06:40 PM
                      0 responses
                      10 views
                      0 likes
                      Last Post algospoke  
                      Working...
                      X