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

Multiple Stops, Multiple Timeframes

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

    Multiple Stops, Multiple Timeframes

    Good morning.


    I have two custom methods (SetFastTrail() and SetSlowTrail()) that use the SetStopLoss() method to set and update stops OnBarUpdate(). OnBarUpdate() is split into two periods using BarsInProgess.

    My primary period is 1-Day, and my secondary period is 5-Minute. Can I set two different stops that run in two different timeframes against one entry using the SetStopLoss() method? Or, do I need to code my own SetStop function to achieve this?

    Cheers,

    Kyle






    #2
    Hello kylegee,

    Thank you for your post.

    No. You'd run afoul of order handling rules that the Managed Approach uses, and the second SetStopLoss call would be ignored. Specifically:

    Methods that generate orders to exit a position will be ignored if:

    •A position is open and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction

    •A position is open and an order submitted by a set method (SetStopLoss() for example) is active


    This would be because if both stops are hit and both are for the full size of the position this would put you in an overfill situation.

    You could get around this by using the Unmanaged approach which does not use these order handling rules. However, you must ensure to handle overfill situations, rejections and errors on your own, which requires advanced programming skill.



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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    149 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    5 views
    0 likes
    Last Post tkaboris  
    Started by GussJ, 03-04-2020, 03:11 PM
    16 responses
    3,283 views
    0 likes
    Last Post Leafcutter  
    Working...
    X