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

Backtesting with tick data after signal from minute bar

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

    Backtesting with tick data after signal from minute bar

    So I have a system that gives a price level signal at the end of a minute bar. I want to test the effect of entering the trade when the tick-level price crosses that level. I have something like this, where series 0 is the 1M and series 1 is the tick:

    if( BarsInProgress == 1 )
    {
    if (condition)
    { EnterLong(0,1,"");
    }
    }

    But this produces mulitpel entries on the minute bar even though Entries Per Direction == 1.

    Thanks in advance

    #2
    Hello futurestack,
    Thanks for posting today.

    Based on the code snipet this does not seem to be the area of concern that is causing your strategy to enter several times.

    What is the exit condition you are using? Does it enter every time the bar updates? When does it enter multiple times?

    I look forward to further assisting.
    Alex G.NinjaTrader Customer Service

    Comment


      #3
      Hi Alex,

      Well I think you are right that I had a stop which was causing the multiple-entry problem.

      The EnterLong which is for the higher timeframe (Series 0) should enter at the price from the tick level, right? That doesn't seem to be happening for me.

      Thanks!

      Comment


        #4
        Hello futurestack,
        Thanks for the inquiry.

        Your EnterLong() order needs to use the secondary series. To fix this change EnterLong(0,1,""); to EnterLong(1,1,"");

        I would like to clarify on this matter. Are you looking for the 1 minute data series to hit a certain value and then see if the added series hits the same level and then submit your order? Or are you waiting for the primary data series to hit a certain value and then submit an order to the secondary data series. If this is the case, please refer to the reference sample at the following link http://www.ninjatrader.com/support/f...ead.php?t=6652

        I look forward to your response.
        Alex G.NinjaTrader Customer Service

        Comment


          #5
          Hi again,

          Thanks, very helpful.

          I have made some progress. I understand now that the entries must be on the tick level even though the entry signals are generated by the higher level bars.

          If I use SetStopLoss in the multiple timeframe code, which timeframe is it set on?

          See the attached image where the stop level is set at 17944. The tick data crosses below that at about 10:30 but the stop doesn't execute until after 12:00.



          Thanks again.

          Comment


            #6
            Hello,

            The order placed by SetStopLoss() will apply to the entry order that was called, rather than a specific bar series. In other words, the bar series to which the entry order was submitted will apply to the stop loss, as well.

            In your screenshot, is it possible that your stop loss is being moved around in your code before it is filled?
            Dave I.NinjaTrader Product Management

            Comment


              #7
              Hi Dave,

              OK, I see. I don't think the stoploss could be moved, but I'll doublecheck and get back to you. Thanks!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by CortexZenUSA, Today, 12:46 AM
              0 responses
              0 views
              0 likes
              Last Post CortexZenUSA  
              Started by usazencortex, Today, 12:43 AM
              0 responses
              2 views
              0 likes
              Last Post usazencortex  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              168 responses
              2,262 views
              0 likes
              Last Post sidlercom80  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              10 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by WeyldFalcon, 12-10-2020, 06:48 PM
              14 responses
              1,429 views
              0 likes
              Last Post Handclap0241  
              Working...
              X