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

order of bars ago. descending or ascending

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

    order of bars ago. descending or ascending

    does it matter if you have the bars ago in descending or ascending order. i start with what happens at close and 1 bar ago. then go to 2 bars ago. then 3. or, do i need to go from 3 then to 2, then 1..then to present price action with close?

    #2
    Hello SteveReiza,

    Thank you for your post.

    It depends, what are you trying to do? I'm not sure if I'm clear on what you are trying to accomplish, if you could please clarify.

    You can check barsAgo in any order. If you just want to compare, for example, the High prices of different bars you can compare these in descending or ascending order. You can check High[0] and then High[1], or check High[1] and then High[0]. Just make sure you have enough bars in order to access the highest barsAgo index your script is accessing by using a CurrentBar check.

    CurrentBar - https://ninjatrader.com/support/help...currentbar.htm

    To be clear, barsAgo in NinjaTrader represents the number of bars from the current bar on which you want to calculate your values. For example, High[0] is the high of the current bar, High[1] is the high of the previous bar, High[2] is the high 2 bars ago, etc.

    Please let me know if I can assist further.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      many thanks for the reply.

      i have a range of something that could happen on 19 bars so i made it into 19 groups with 'any' selected and 'all' selected for the group for the entry criteria. but the groups are in all random order. and, i'm not getting executions on the strategy. so, was wondering if the sequence of the bars ago albeit in the groups randomly are affecting that. i'm organizing them now. hopefully that helps.

      Comment


        #4
        Hello,

        It's hard to say what could be going on without seeing how the strategy logic is being executed. I recommend debugging using prints and TraceOrders.

        If the expected trade(s) are not appearing, this would indicate that the condition to place the order is not evaluating as true and the order is not being submitted, or the order is being ignored for other reasons, or the order is being cancelled.

        The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

        Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

        Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.

        I am happy to assist you with analyzing the output from the output window.

        Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

        Below is a link to a forum post that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.


        Please let me know if I may further assist with analyzing the output or if you need any assistance creating a print or enabling TraceOrders.​
        Gaby V.NinjaTrader Customer Service

        Comment


          #5
          thanks for the reply. yah, its strange. the strategy executes sometimes. and, sometimes it doesn't. i have some others where i know the entry conditions are there on the chart, but its not executing the strategy. that's cool the print will show what's going on. i'll dial in on that.

          is there a minimum bars ago required that i'm not at? because i'm only looking back from present, to 1, and 2. and present to 1, 2, and 3.

          Comment


            #6
            Hello,

            If by 'minimum barsAgo required' you mean if there is a minimum amount of bars ago you are required to look back, no there is not.

            To determine exactly what's going on, I recommend going ahead with the debugging process using prints and enabling TraceOrders.

            Please let me know if you need any assistance with creating prints, enabling TraceOrders, or analyzing the output!
            Gaby V.NinjaTrader Customer Service

            Comment


              #7
              thanks for the reply. okay sweet. i'll key in on that!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Philippe56140, Today, 02:35 PM
              0 responses
              1 view
              0 likes
              Last Post Philippe56140  
              Started by 00nevest, Today, 02:27 PM
              0 responses
              1 view
              0 likes
              Last Post 00nevest  
              Started by Jonafare, 12-06-2012, 03:48 PM
              5 responses
              3,986 views
              0 likes
              Last Post rene69851  
              Started by Fitspressorest, Today, 01:38 PM
              0 responses
              2 views
              0 likes
              Last Post Fitspressorest  
              Started by Jonker, Today, 01:19 PM
              0 responses
              2 views
              0 likes
              Last Post Jonker
              by Jonker
               
              Working...
              X