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

ATM NinjaScript Strategy: REVERSE at STOP then NOT

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

    ATM NinjaScript Strategy: REVERSE at STOP then NOT

    How do I write into a strategy for Reverse at Stop Loss, and if it triggers, I don't want it to have Reverse at stop loss again, just regular Stop Loss.

    Example: If ATM Strategy is Set to BUY 1 Contract @ 1.900 and Stop set 1.890. I want it to reverse @ 1.890, but I Don't want the NEW Stop Loss to have Reversal.

    Possible??? How?

    #2
    Hello ginx10k,

    Thanks for your post.

    To prevent the auto reversal, please make sure that under "advanced Properties" of the dom you have unchecked the "rev at stop" feature.

    In your strategy code you will want to check in OnExecution() to see if "Stop1" was the name of the last order filled. Then you would enter an order in the opposite direction. You can use a bool like doItOnce initilized to true to prevent a 2nd reversal

    protected override void OnExecution(IExecution execution)
    {
    if (execution.Name == "Stop1" && doItOnce)
    {
    // enter your next order here
    doItOnce = false; // set to false so the reversal doesn't reverse again
    }
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      1. To enter an order in the opposite direction would I use the AtmStrategyCreate() Method?
      2. If my strategy goes both long and short, how would I know whether it was a short or long position? (If I have to enter the reversed position by AtmStrategyCreate)

      Comment


        #4
        Hello MisterGee,

        Thanks for your post.

        You would want to use AtmStrategyClose() to close the current position then use the AtmStrategyCreate() to enter a new order.

        http://ninjatrader.com/support/helpG...ategyclose.htm
        http://ninjatrader.com/support/helpG...tegycreate.htm

        You can verify position with: http://ninjatrader.com/support/helpG...etposition.htm
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        24 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        46 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        23 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        181 views
        0 likes
        Last Post jeronymite  
        Working...
        X