Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

diffferent timeframes for indicators and executions

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

    diffferent timeframes for indicators and executions

    Hi

    Is there an example of how to use in the same strategy :

    1) execution on a 1 min timeframe
    2) using values from indicators calculated on a higher time frame (for example 30 min )
    meaning i want to enterlonglimit with the limit price derived from a value calculated on the 30 min time frame (not enterlong with a market order)

    would the primary timeframe be 1 min and use a secondary time frame as 30 min?

    then calculate the indicators values and save in a local variable on the Onbarupdate for the 30 min series. then use the values in the saved variable on the onbarupdate for the 1 min series for execution ?

    any advice on how to proceed and/or an example would be appreciated.

    #2
    Hello,

    Thanks for the note.

    The best way is to use BarsArray[].for indicator values.

    Please see this section that shows how to do this.

    Using Bars Objects as Input to Indicator Methods



    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Thanks

      would the execution be the same between these 2 scenarios :

      1) 1min as primary and 30 min as secondary : using BarArrays[] to calculate higher time frame indicators value within the 1min series barsinprogress context and executing directly in the 1 min timeframe.

      OR

      2) 30 min as primary and 1 min as secondary : calculate the indicators values under the 30 min series barsinprogress context and executing in the 1 min timeframe using the barsInProgressIndex parameter of the enterlonglimit function ?

      the second method is described here :
      You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


      What is the difference between the 2 if any ?
      Last edited by qewcool; 04-13-2011, 03:54 PM.

      Comment


        #4
        Hello,

        They would almost perform the same. The only difference in the first scenario is that you have more points and bar closes in the 1 minute series to take other actions should you wish to do so. Such as mabye take a trade for a 1 min setup. With this flipped around you would not have this ability.

        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment


          #5
          Thanks

          Started to work on the second method since there was example code ready in the reference section.

          I see that with the second method (30 min as primary and 1 min as secondary) you need to set the Liveuntilcancelled parameter of a limit or stop order function (ie for example enterlonglimit) to true for orders to get executed since if it is set to false the order will get cancelled on the next 1 min bar and not get renewed until the 30 min bar updates. But if you do that then you need to manage the order cancellation of outstanding limit and stop orders.

          questions :

          1) Is there a way to keep the 1 min bar order alive until the next 30 min bar without setting the liveuntilcancelled parameter to true (ie get the order to be renewed for each 1 min bar until the 30 min bar completes) ?

          2) if not, how can you check if a limit or stop order is still outstanding in order to call the cancelorder() function. You check if the order is not null ?

          Comment


            #6
            Hello,

            Sure:

            1) Is there a way to keep the 1 min bar order alive until the next 30 min bar without setting the liveuntilcancelled parameter to true (ie get the order to be renewed for each 1 min bar until the 30 min bar completes) ?
            You cannot do this as it will run on the BarsInProgress series you submit with.

            2) if not, how can you check if a limit or stop order is still outstanding in order to call the cancelorder() function. You check if the order is not null ?
            Please see this sample on how to cancel orders. Would also apply to your Entry orders.

            When using NinjaTrader's Enter() and Exit() methods, the default behavior is to automatically expire them at the end of a bar unless they are resubmitted to keep them alive. Sometimes you may want more flexibility in this behavior and wish to submit orders as live-until-cancelled. When orders are submitted as live-until


            Let me know if I can be of further assistance.
            BrettNinjaTrader Product Management

            Comment


              #7
              Thanks for the help

              I managed to complete it but had to put the execution portion in the barsinprogress=1 context (ie the 1 min series)

              Didnt work with execution in the barsinprogress=0 context (ie the 30 min series) ... I think my cancellation of outstanding orders is flawed :

              One question regarding orders with parameter liveuntilcancelled set to true :

              1) You issue an initial enterlonglimit order with parameter liveuntilcancelled set to true at price x. If you reissue the same enterlonglimit order (ie same order name in the strategy) at another price level y on subsequents barupdate with parameter liveuntilcancelled set to true, my understanding is that this second order will replace and cancel the first initial order ? so no need issue a separate cancellation order for the initial order ?
              Last edited by qewcool; 04-18-2011, 09:10 AM.

              Comment


                #8
                Hello,

                Here is whats mentioned in the help guide:

                liveUntilCancelled
                The order will NOT expire at the end of a bar, but instead remain live until the CancelOrder() method is called or its time in force has been reached.


                Therefor it will remain active until you do the following. SO you will need to first Cancel the order and then resubmit if you set liveUntilCancelled = true.

                Let me know if I can be of further assistance.
                BrettNinjaTrader Product Management

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                666 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                376 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                110 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                575 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                580 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X