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 stop Intrabar Trading while using 'On each tick' Strategy Builder NT8

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

    How to stop Intrabar Trading while using 'On each tick' Strategy Builder NT8

    I am using Strategy Builder and need to utilize "On each tick" or "On price change" for dynamic control of the stop loss. Although my logic conditions show that the calculation should be done on close of the current bar, I keep seeing the real trades on live testing being taken intra bar and opposite of the logic. I can only assume that at some point during the bar that the condition was true--I am specifically talking about the 3 trades shown with the blue bar. If done correctly, there would have been a short here instead of a long. Also, if you look at the entries , you can see they are occurring while the bar is being constructed instead at the close.

    Is there a way to stop this from happening without unlocking the code?

    Also, is there away to make this forum searchable? I'm quite sure you've probably already answered this question for someone elsewhere, but there is no way to search as far as I can tell.Click image for larger version

Name:	TODAY'S TEST ACTION 09092021.JPG
Views:	161
Size:	264.9 KB
ID:	1170594

    #2
    Hello Juggernaut_Trades,

    Thanks for your post.

    At the top of each topic/thread, there is a search bar.
    Click image for larger version

Name:	topicSearchBar.PNG
Views:	231
Size:	35.9 KB
ID:	1170597

    At the top of the page, there is a search bar.

    Click image for larger version

Name:	ForumSearchBar.PNG
Views:	188
Size:	25.4 KB
ID:	1170598


    When a strategy uses intrabar processing (IE: Calculate.OnEachTick or Calculate.OnPriceChange), on live or Playback with Market replay data, it is possible that your entry conditions can be true many many times per bar.

    To limit your conditions to being true once per bar you will need to add another condition that can only be true once per bar. The easiest way to do this is to create an int type variable called "EntryBar. Add the condition Miscv>Current bar, NOT Equal, UserVariable>EntryBar. In the actions section, add the action Misc>Set EntryBar and in the "field, click "set" then select Misc>CurrentBar.

    What happens is that when your entry conditions are true, the first time in the bar, Current bar will not be equal to the EntryBar so these true conditions will allow the action of placing your order and setting the EntryBar equal to the Current Bar. On the next tick or price change, your entry condition may still be true however now Current bar is equal to EntryBar so the condition would be false and thus no action will occur at least until the next bar.

    Here is a short video on how to construct this: https://paul-ninjatrader.tinytake.co...Nl8xNDc5OTg3Mg

    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by usazencort, Today, 01:16 AM
    0 responses
    1 view
    0 likes
    Last Post usazencort  
    Started by kaywai, 09-01-2023, 08:44 PM
    5 responses
    603 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by xiinteractive, 04-09-2024, 08:08 AM
    6 responses
    22 views
    0 likes
    Last Post xiinteractive  
    Started by Pattontje, Yesterday, 02:10 PM
    2 responses
    21 views
    0 likes
    Last Post Pattontje  
    Started by flybuzz, 04-21-2024, 04:07 PM
    17 responses
    230 views
    0 likes
    Last Post TradingLoss  
    Working...
    X