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 set Target always equals to a defined stop (1:1 Risk Reward)

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

    How to set Target always equals to a defined stop (1:1 Risk Reward)

    How to set Target always equals to the stop (1:1 Risk Reward) and Stop is define by an indicator and is not a static value?
    Also want to add a runner which stop will shift to break even after the target gets hit. But have no clue how to add those conditions on the strategy builder wizard.
    I'm new to NT and have no knowledge of coding. I just tried using strategy builder but got stuck here.

    #2
    Hello hijam999, thanks for your post.

    It depends on what kind of value you are getting from the indicator. You can not use the SetStopLoss or SetProfitTarget for this since the stop and target price are dynamic based on an indicator.

    Instead, use the ExitLong orders to submit the stop and target. I attached an example that uses the Bollinger. You must set Order Fill Resolution to High in the strategy settings to get this to work.

    Please let me know if I can assist any further.
    Attached Files
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Only the Stop is based on an indicator but target will be based on the Stop i.e, Entry price minus Stop price will determine the target price.
      For example: Let us say I'm trading a swing breakout (long side) and I will keep the recent swing low as the stop. So the target will the same value as the stop above the entry.
      Let us say: x = entry price - stop price, then entry price + x will be the target.

      I got stuck here.

      Comment


        #4
        Hi hijam999, thanks for your reply.

        Regrettably, that type of arithmetic must be done with unlocked code. In the builder, you can not do arithmetic between two variables to use in another variable. An example modification of the original example I posted would be written as:

        Code:
        // Set 1
        if (Position.MarketPosition == MarketPosition.Flat)
        {
            EnterLong(Convert.ToInt32(DefaultQuantity), "");
            SetStops = true;
        }
        
        // Set 2
        if (Position.MarketPosition == MarketPosition.Long)
        {
            ExitLongStopMarket(Convert.ToInt32(DefaultQuantity ), Bollinger1.Lower[0], "", "");
            double x = Position.AveragePrice - Bollinger1.Lower[0];
            ExitLongLimit(Convert.ToInt32(DefaultQuantity), Position.AveragePrice + x, "", "");
            SetStops = false;
        }
        Please let me know if I can assist any further.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by BarzTrading, Today, 07:25 AM
        2 responses
        15 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
        162 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