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

How to set Prior Day Hi Lo > 150 points in strategy builder

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

    How to set Prior Day Hi Lo > 150 points in strategy builder

    Hi!
    I'm not a programmer, so I'm limited to the strategy builder...

    Step 1 is a check if the prior day hi lo is more than 150 points, bu it doesn't work when I do a backtest. Please see attachment for the condition.
    What am I doing wrong?

    Thanks for helping

    Click image for larger version

Name:	150p.png
Views:	224
Size:	20.5 KB
ID:	1081960

    #2
    Hello deetee,

    Thank you for your note.

    In my testing, this condition fires off fine on historical data, even during a backtest.

    What I'd suggest here is to add some prints to your code to make sure what values are at different points in your code. For example, you could print the CurrentBar index along with the value of Y150Points on each bar, and figure out exactly on what bar that changed.

    Adding prints to your strategy that will show in the NinjaScript Output window (New > NinjaScript Output), with information on what the variables you're using for your conditions are on a particular bar, can be helpful.

    This forum post goes into great detail on how to use prints to help figure out where issues may stem from — this should get you going in the correct direction. You can even add these using the Strategy Builder.



    If you run into issues like we saw here, the above information will allow you to print out all values used in the condition in question that may be evaluating differently. With the printout information you can assess what is different between the two.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi Kate, thanks for your reply. I had a look into the link for printing and that's great help.

      When I run my strategy, the printed output seems not to be consequent. It should contain 2 prints per (30min) bar. Please find attached an example of the output. For example on 11-12 and 13-12 it is showing the 2 lines per bar, which seems good to me. But on 12-12, it only shows one of the printed outputs for each bar, and only on the first bar it shows also the other printed output.

      I also see this for other dates and I tried to see a logic in this, but I couldn't. Would you know what is causing this inconsistency?

      Thanks again
      Click image for larger version

Name:	150p output.png
Views:	188
Size:	572.6 KB
ID:	1082088



      Comment


        #4
        Hello deetee,

        Thank you for your reply.

        Without seeing the strategy, I wouldn't be able to tell you why you're not getting prints where you'd expect. Are you testing on Historical or Market Replay data? If you're comfortable sharing what you've got here, you can export the strategy from Tools > Export > NinjaScript Add-On as a .Zip file (don't choose the option to export as a compiled assembly or I won't be able to review the code).

        You can then attach it to your reply, or if you'd rather not share it publicly, you can also send it to platformsupport [at] ninjatrader [dot] com. If you go that route, please include "2373544 ATTN Kate W" in the subject line and a link to this thread in the body of the email.

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Thank Kate, I have just send the strategy .zip by email. I'm using historical data.

          Comment


            #6
            Hello deetee,

            Thank you for your note.

            I've received and looked over your strategy, and the reason why you're not seeing the second print every time is that it is set up so that you only print that print if PriorDayOLHC(High).PriorHigh[1] - PrevHiLo > PriorDayOLHC(Low).PriorLow[1]. So It's only printing when that's true. Try adding the print to a set with no conditions instead - that will make it so it will print on every bar.

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Hello Kate,

              Thanks, understand.
              I looked for the printing because most of the trades are being made, while it's not intended ))

              To continue with the example I have sent before, the strategy triggers a trade on 12-12-19 17:00.
              1> Exit time is the same, while entry price and exit price are different. Is there an explanation for this?
              2> With the condition: PriorDayOLHC(High).PriorHigh[0] - PrevHiLo > PriorDayOLHC(Low).PriorLow[0] I'm trying to say: Prior day high must be 150 points (PrevHiLo) higher then prior day low. Is this condition correct formulated?
              3> I also tried this condition with bars ago 1. Not sure, but I assume that bars ago 0 = prior day. Is that assumption correct?

              Thanks
              Dennis

              Comment


                #8
                Hello deetee,

                Thank you for your reply.

                Originally posted by deetee View Post
                To continue with the example I have sent before, the strategy triggers a trade on 12-12-19 17:00.
                1> Exit time is the same, while entry price and exit price are different. Is there an explanation for this?
                I would need more information regarding your testing to be able to answer this. What instrument and interval (example: FDAX 60 minute) are you running this on? Are you saying that the entry time and the exit time are listed as being the same? What is the exact behavior you're seeing?

                Your condition is fine and works - you can always add prints so you can print the value of the items you're using in your conditions to make sure the values you're getting make sense.

                Bars ago 0 is always going to be the value of whatever thing for the most recent bar, so that's definitely what you want in this case.. This can be a little confusing when you're working with indicators like the PriorDayOLHC, because the value for the current bar is technically a value for yesterday.

                Here's a link to our help guide that goes into how that Bars Ago notation works:


                Please let us know if we may be of further assistance to you.
                Kate W.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Kate,
                  Happy new year!!
                  Thanks for explaining all. I understand now why trades were triggered and could resolve it.
                  Appreciate your support, thanks
                  Dennis

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Tim-c, Today, 10:58 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post Tim-c
                  by Tim-c
                   
                  Started by traderqz, Yesterday, 09:06 AM
                  3 responses
                  21 views
                  0 likes
                  Last Post NinjaTrader_ThomasC  
                  Started by f.saeidi, Today, 10:19 AM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by kujista, Today, 06:23 AM
                  5 responses
                  18 views
                  0 likes
                  Last Post kujista
                  by kujista
                   
                  Started by traderqz, Today, 12:06 AM
                  3 responses
                  6 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Working...
                  X