Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

1 Min Granularity not working

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

    1 Min Granularity not working

    Hi Ninjas,

    I have a 15 min series with a 1min series for finer granularity of backtest being initialized also as BarsArray 1. The backtests show trades exiting on the 15min bar but on the 1 min they never would, so it would seem the 1 min data is not being used for the execution even though I am sending EnterLongLimit orders to the BarsArrayIndex of 1 when creating orders in when (BarsinProgress=0). Any suggestions?

    Thanks in advance!

    Arilano

    #2
    Hi Arilano, thanks for the post.

    'The backtests show trades exiting on the 15min bar but on the 1 min they never would'

    The 1 min here is used to give you a finer estimate of the fills, the condition to exit (order sent) would still come from the primary 15 min chart in your setup.

    How do you exactly determine this should be filled differently?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      Ah that's is the issue how can you model the exits using the 1 min granularity? I have 1 min data how can it be utilised? Fills of the initial order are not really the issue.

      I had looked at using a 1min series with 15min secondary series for signals, would this work? 1 min charts are awful to look at though.

      Thanks!

      Comment


        #4
        To act on the 1 min series, you would need to operate logic then in BarsInProgress == 1 in your setup.

        This can even happen with the 15 min being primary, so you would not need to visualize the 1min.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thankyou Bertrand, this level of response, customer service and helpfulness is EXACTLY why I have purchased a lifetime license to NT.

          Thanks
          arilano

          Comment


            #6
            Hi Ninjas,

            I have modified my code to do all trade logic in BarsInProgress == 0 (15 Min) and to enter all trades using the overridden EnterXXXXLimit() methods within BarsInprogress == 1 (1 min) and using the BasrsInProgress Index set to 1 within the EnterXXXLimit() call I'm still not getting the exit fill behaviour I am looking for with backtests.

            Do you have any ideas?

            Comment


              #7
              Hello Arilano,

              Thank you for your response.

              So do you see the Enter() methods correctly?

              Can you provide the Enter() and Exit() methods used and the full syntax you are using?

              If you are processing you conditions on the primary bar series, your exits and entries will not be submitted until the primary bar closes. While they will fill intra-bar they will not be submitted intra-bar.

              Comment


                #8
                Hi Patrick,

                Thanks for the quick response, I have included my code below I'm hoping to get intra bar 1min exits on fills and exits using the 1min series but 15min series for signals, any ideas?


                protected override void OnBarUpdate()
                {

                if (BarsInProgress == 0)
                {

                // Calculate signal
                if (Position.MarketPosition == MarketPosition.Flat)
                {

                if (Condition true){
                executeStrategy = true;
                }

                } else {

                SendMail();
                }




                }

                if(BarsInProgress == 1)
                {
                SetProfitTarget();
                SetStopLoss();

                if (executeStrategy == true)
                {
                myEntryOrder = EnterLongLimit(1,true,tradeQuantity,GetCurrentBid( ), "Long");
                barNumberOfOrder = BarsArray[1].CurrentBar;

                executeStrategy = false;
                }

                if (myEntryOrder != null && BarsArray[1].CurrentBar > barNumberOfOrder + barsOrderLive)
                CancelOrder(myEntryOrder);

                ...
                }

                Comment


                  #9
                  Hello Arilano,

                  Thank you for your response.

                  Unfortunately, the Set() methods will only work on the primary series. You will need to use the Exit() methods rather than SetStopLoss() and SetProfitTarget().

                  Please let me know if you have any questions.

                  Comment


                    #10
                    Thankyou, I will try this out, much appreciated

                    Comment


                      #11
                      Hi Ninjas,

                      I have edited my code to use Exit methods and handle order cancellation etc, I think this works fine. When I run a backtest in the strategy analyser window it works, as I can see Print statements and in the console window but the backtest never actually returns. Do I have a situation where a method is not being exited somewhere? Or have you heard of this before?

                      Thanks!

                      Comment


                        #12
                        Nevermind, restarted and is returning fine now Thanks for all your help

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by love2code2trade, Yesterday, 01:45 PM
                        4 responses
                        28 views
                        0 likes
                        Last Post love2code2trade  
                        Started by funk10101, Today, 09:43 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post funk10101  
                        Started by pkefal, 04-11-2024, 07:39 AM
                        11 responses
                        37 views
                        0 likes
                        Last Post jeronymite  
                        Started by bill2023, Yesterday, 08:51 AM
                        8 responses
                        45 views
                        0 likes
                        Last Post bill2023  
                        Started by yertle, Today, 08:38 AM
                        6 responses
                        26 views
                        0 likes
                        Last Post ryjoga
                        by ryjoga
                         
                        Working...
                        X