• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Builder Example

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

    Strategy Builder Example

    I am learning about strategy builder and NinjaScript and doing a simple RSI overbought and oversold strategy. Does anyone have any examples I can learn from? I am just looking for an example that has if else if statements on when certain indicators meets a condition with a StopLoss(), TraillingStop(), and ProfitTarget() order execution

    #2
    Hello w0lverine,

    Thanks for your post.

    In the strategy builder you would create a "set" for overbought and a "set" for "oversold". the reason you would do this is that the "action" as a result would likely be different for each.

    So for example in set one, if the RSI was overbought, the action could be to sell short, in set two if the RSI is oversold, the action could be to buy long.

    The stop and target would be created in the "Stops and Targets" window of the strategy builder. The simplest option to use is to place a fixed stop and a fixed target using the mode of "ticks" and specifying a set amount of ticks. Please note that you cannot use both a trailing stop and a fixed stop on the same order if so, only the fixed stop will be used.

    To clarify on the Stop and Target, by using the mode of Ticks and a fixed amount, what happens when an entry is filled is that the strategy will automatically create the stop and target the ticks away from the entry according to the entry direction, so in the case of a short order entry and using a 10 tick stop and 20 tick profit, the strategy will automatically use the filled entry price and subtract 10 ticks for the stop target and will add 20 ticks to the entry price for the profit target. If a long entry, then the stop is placed 10 ticks below the entry and the target 20 tick above the entry.

    If you haven't already you may want to attend the free live training on the strategy builder where all of this is explained. The live training occurs every other Thursday (alternates weeks with Ninjascript editor training): https://ninjatrader.com/PlatformTraining

    Here is a link to a previous recording: https://www.youtube.com/watch?v=HCyt...We0Nf&index=11
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_PaulH Thanks for the descriptive answer. I see my mistake now. And I thought I read somewhere that we can't combine a trailing stop with the stoploss function. Is there a reason why? I mean could I set the trailing stop for 10 ticks and it will trail with every tick "acting as my stop loss"?

      Comment


        #4
        Hello w0lverine,

        Thanks for your reply.

        If you are looking for examples of how to set up an indicator to compare to a numeric value, please see the section "How to make indicator to value comparisons" in the strategy builder's condition builder examples here: https://ninjatrader.com/support/help...on_builder.htm

        Regarding the StopLoss and SetTrailStop, in the help guide section for the SetTrailStop() are these two notes:

        The SetTrailStop() method can NOT be used concurrently with the SetStopLoss() or SetParabolicStop() method for the same position, if any of methods are called for the same position (fromEntrySignal) the SetStopLoss()will always take precedence. You can however, use all three methods in the same strategy if they reference different signal names.

        Trail stop orders are modified based on the strategies 'Calculate' settings. In the case of 'Calculate' on bar close, when the bar closes the trail stop order modification will occur using the closing price of the bar as the reference price to apply the trail offset. Subsequently if the open price of the next bar is significantly higher or lower then the current close price then there is a possibility that the calculated trail stop price is now an invalid stop price. This is a risk with modifying any stop order closer to the current market price since any modification above/below the current price would be rejected.

        A fixed stop is used as it is a more conservative approach.

        "I mean could I set the trailing stop for 10 ticks and it will trail with every tick "acting as my stop loss"?" This is exactly what the trailing stop does, for every tick increase in profit that the current price is, the trailing stop will move to maintain no less than 10 ticks behind the highest profit level achieved, it will not go backwards. You can certainly test this on the sim101 account.

        You may want to further increase your knowledge of strategies by reviewing the "Managed approach" help guide section. Even though you are using the strategy builder, the strategy builder follows the managed approach: https://ninjatrader.com/support/help...d_approach.htm "The Managed approach in NinjaScript is designed to offer the greatest ease of use for beginner to intermediate programmers. The order methods are wrapped in a convenience layer that allows you to focus on your system's trading rules, leaving the underlying mechanics of order management and the relationships between entry orders, exit orders, and positions to NinjaTrader. This approach is best suited for simple to moderate order complexity, and can be further broken down into a Basic/Common Managed approach and a more Advanced Managed approach..."
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by liltr3d, Yesterday, 10:52 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by marekflys, Yesterday, 03:07 PM
        1 response
        16 views
        0 likes
        Last Post NinjaTrader_EricB  
        Started by w0lverine, Today, 03:57 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_ChrisSch  
        Started by hundert, 02-24-2019, 07:55 AM
        2 responses
        43 views
        0 likes
        Last Post jpraema
        by jpraema
         
        Started by digibob, Today, 02:47 AM
        0 responses
        3 views
        0 likes
        Last Post digibob
        by digibob
         
        Working...
        X