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

Bars since Entry, Bars since Exit

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

    Bars since Entry, Bars since Exit

    I have watched numerous video and cannot find the simple answer to the following:
    I want the strategy to enter a position based on the Condition of a crossover but only after 10 bars have painted since the last exit.
    What do I put in the left box and where?
    What do I put in the right box and where?

    #2
    Hello TrendFollowingCapital,

    Thanks for your post.

    For the bar since exit execution, you have correctly selected the condition on the left. On the right side you need to select the "Misc" folder and from there select "Numeric value" and then enter the value of 10.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi Paul
      Thank you for your reply.
      I added in the variables exactly as you said now the strategy will not execute any positions at all.

      I heard on a video or a post somewhere you need to put in a -1 or something like that, but not able to remember where?

      There should really be a training video on this, it is very briefly mentioned in the Strategy builded 301 video or one of those but absolutely no clarification or working examples.
      I cannot find 1 vide on YouTube to explain how this feature works, perhaps you know of one?

      Comment


        #4
        Hello TrendFollowingCapital,

        Thanks for your reply.

        With reference to the help guide here: https://ninjatrader.com/support/help...texecution.htm that is correct, if there is no previous exit the method returns a -1. When used as an entry condition, this would prevent the first trade from occurring (and all other trades) unless you also accounted for the -1 value.

        In the strategy builder, you would have to create a "group" that is set to "If any" and then place both conditions in there of >10 and = -1. The "if any", in the group set only, creates the "or" condition. With the conditions set that way, when used as an entry condition the -1 value will be true allowing the first trade to occur and thereafter the -1 will no longer be returned and the method will return the number of bars since the latest exit.

        For your convenience, I have attached a screenshot that shows the "condition group" inside the condition of set 1 to help you recreate.

        Click image for larger version

Name:	TFC-1.PNG
Views:	1529
Size:	35.0 KB
ID:	1057804

        For further references on how to create a group condition, please see " How to create time filters" on this page: https://ninjatrader.com/support/help...on_builder.htm
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thank you Paul, this works perfectly, and the 1st time I have ever seen this explained properly.
          Kind regards, Jason

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by kevinenergy, 02-17-2023, 12:42 PM
          118 responses
          2,777 views
          1 like
          Last Post kevinenergy  
          Started by briansaul, Today, 05:31 AM
          0 responses
          6 views
          0 likes
          Last Post briansaul  
          Started by fwendolynlpxz, Today, 05:19 AM
          0 responses
          4 views
          0 likes
          Last Post fwendolynlpxz  
          Started by traderqz, Yesterday, 12:06 AM
          11 responses
          28 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by PaulMohn, Today, 03:49 AM
          0 responses
          8 views
          0 likes
          Last Post PaulMohn  
          Working...
          X