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

strategy is doubling trade quantity (NT7)

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

    strategy is doubling trade quantity (NT7)

    I have a trade strategy that is Calculate on bar close = True. It takes a trade on a breakout of a consolidation zone, with a stop set at the opposite side of the zone. When I get stopped out of a trade, a new trade in the opposite direction usually gets triggered because a close on breakout has occurred, but the trade is getting entered for double the trade quantity that the strategy specifies. I have tried changing the stop criteria to be +/- various tick settings in relation to the consolidation zone perimeter, but because the bar size I'm using is relatively large, both the stop and the reverse entry usually are triggered on the same bar close. Why is NT getting confused and doubling the entry? Is there anything I can do in my script to prevent this?

    #2
    Hello,

    Thank you for the post.

    In this situation, if you have a stop order and an entry condition happening in the same bar, and they are both orders that can fill in that bar, the position would not be updated for the second called method which can lead to incorrect quantities.

    Generally, you must wait for at least one OnBarUpdate call to then call the next entry method so it is up to date. This can either be 1 tick or the bar series calling OnBarUpdate.

    To resolve this, you could potentially add logic to determine if this bar should be stopped out and set a flag to not enter until the next bar and reset the flag. You could also use logic to determine if it should use either the stop or reverse in this bar to avoid using both.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by BarzTrading, Today, 07:25 AM
    2 responses
    24 views
    1 like
    Last Post BarzTrading  
    Started by devatechnologies, 04-14-2024, 02:58 PM
    3 responses
    20 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by tkaboris, Today, 08:01 AM
    0 responses
    4 views
    0 likes
    Last Post tkaboris  
    Started by EB Worx, 04-04-2023, 02:34 AM
    7 responses
    163 views
    0 likes
    Last Post VFI26
    by VFI26
     
    Started by Mizzouman1, Today, 07:35 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X