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

Lin. reg. slope in Strategy Builder

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

    Lin. reg. slope in Strategy Builder

    Hello,

    I'm trying to build a strategy that will detect steep angling uptrends.

    I started by creating a Strategy using the Lin. reg. slope indicator and then ran an Optimization on it in the Strategy Analyzer.

    For one thing, I could not figure out a way to only enter long trades on upward angling slopes? How would I tell the indicator or Strategy Builder to only enter long on upward angling slopes?

    Secondly, it seems that no matter what values I use during the optimization, I get the same Total net profit results and it does not appear that the values I use in the parameters affect the steepness of the price moves that the indicator choosed to enter trades on.

    The first set of values that I used were: 5;75;5

    The second set of values that I used were: 1;5;1


    I also do have a Profit Target and Stop Loss set in this Strategy.

    How could I get the Strategy Builder to only enter long trades when the angle of the price move is steep, to the upside?

    And why are the results so similar? Is there a way to cause the results to vary to a larger degree?

    Screenshots attached.
    Attached Files

    #2
    Hello i2w8am9ii2,

    Thanks for the post.

    EnterLong(), or any of the EnterLong methods will always submit buy orders. Using those order methods should only produce long positions. Additional evaluation of the strategies logic will need to take place to get the strategy to behave the way you need it to.

    For the strategy analyzer results. It could be expected since you are fitting the optimization to the same time frame. I see the values produced are not similar, but quite close. The Strategy Analyzer will not cache results in any way so after you click the Run button, the results that are produced are the outcome of the last optimization. I also noticed that when using percent as an offset, it simply multiplies the number, so you are multiplying the result by a whole number every time the condition is evaluated, so that might cause issues as well.

    Please let me know if I can help further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris,

      Thanks for your reply.

      I'm not a programmer, so evaluating the Strategy logic via the code is not an option for me.

      But that is okay, the other two Strategy Analyzer Optimizations that I ran only entered long trades, and I was able to determine the best parameters to use for the indicator, because the results varied quite a bit.

      I don't understand when you said the following:

      I also noticed that when using percent as an offset, it simply multiplies the number, so you are multiplying the result by a whole number every time the condition is evaluated, so that might cause issues as well.

      Could you provide an example or specific inputs to use that will work, or be more detailed, so that I can figure out what you mean? As I am new with the Strategy Builder and Strategy Analyzer and do not know programming.

      Thanks,

      Comment


        #4
        Hello i2w8am9ii2,

        Thanks for the reply.

        If you look at the condition statement in your screenshot, with the offset applied it is multiplying the input property "SlopeValue1" by the result of the Momentum, while using a percentage it is expecting a fraction and not a whole number.

        I advise using Print statements to observe the values that your strategy is producing. You can do this by making a new set, then make an action with a Print (in the Misc folder) and leaving the conditions blank, so it runs on every bar update. Please see the screenshot link for an example. You can view the output via New>NinjaScript Output.



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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        44 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        20 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        180 views
        0 likes
        Last Post jeronymite  
        Started by DanielSanMartin, Yesterday, 02:37 PM
        2 responses
        13 views
        0 likes
        Last Post DanielSanMartin  
        Working...
        X