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

Impossible to Optimize on dynamic range?

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

    Impossible to Optimize on dynamic range?

    I would like to use Strategy Analyzer to set a support/resistance line at each price point within the daily range of the ES and see what the outcome would be if trades were only taken at that specific price.

    For example, if the daily range was 2400-2410, I'd want to take trades that only happened at 2400 for that day, then re-run the test at 2400.25, 2400.50....etc. So, there would be 40 total tests (10 / 0.25).

    The obvious problem is that the Optimizer requires a hard-coded range and I don't think there's a way to put the dynamic daily range in there...is this correct? If that's true, does anyone have any suggestions on how to implement this?

    The only thing I could think of is to create 2 custom properties (RangeHigh, RangeLow) and set them with a huge range (500-3500) in the Optimizer which would cover the last and the next 5 years and then set the iteration value to 1 * TickSize. Then, I'd have OnBarUpdate check what the previous day's High/Low was and assume today's range will be within +-100 points. Finally, if the Optimizer is trying run a test outside that range, have OnBarUpdate exit out of the test.

    Is this possible? Can OnBarUpdate detect properties changed by the Optimizer iterations?

    #2
    Hello,

    Thank you for the post.

    Perhaps I am not fully understanding your overall goal in the logic, but would it be possible to make an offset parameter for the price you are trying to increment?

    For example, a double value that can be optimized from 0 - 1 as an example. You could increment this by the TickSize of the instrument if needed or any value you want really. In your logic, you could then use this value in your criteria to trade.

    For example, if the daily range was 2400-2410, the price used in the condition could be the daily range 2400 + the offset variable. This would then equate to 2400 + 0, 2400 + 0.25 etc.. Each iteration could then check this in the condition to trade and change based on the offset being optimized.

    Otherwise, you would need to pre-plan the ranges you use in the optimization as only the scripts logic will be dynamic for each iteration. The above would be one way to add some dynamic changes to the script in relation to an optimized property, but this may or may not be what you need depending on your goal.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse, thanks for the fast reply!

      My strategy is based on price action so what I want to do is use the Optimizer to find out which price levels would have produced the top ten trades for that day. I was going to do this through 'brute force' by only allowing trades to take place at one specific level for each iteration. After testing several weeks/months worth of data, I'd find the best price levels to use during live trading...hopefully.

      The problem is that the Optimizer requires manually entered ranges and steps. Ideally, the Optimizer could dynamically know either the day's High/Low, or from your suggestion, the number of values to multiply against ticksize. I don't think I can use your suggestion directly because I'd still need to know the beginning and ending value to multiply by.

      The range of the ES in the last year is about 450 points. If I wanted to use the Optimizer to test each price level of just one day, I have to run 1800 iterations (450 x 4) for each day, the vast majority of tests would be 'wasted' because the daily range is much smaller. If I created a list of daily ranges for the last year to use in my strategy, I could have OnBarUpdate just 'return;' out of that test run if Optimizer has set the properties outside the range, but again, it's running 1800 times when I only need it to run about 100 times.

      I haven't tested it yet but maybe running 1800 times per each day of testing won't take long but it just seems inefficient.

      Do you see any other way to have the Optimizer run tests only within the day's High/Low range without having to set the range manually and running only one day at a time?

      If you see no other way, then I'd like to request a feature to allow Optimizer to use properties and steps that are set by the strategy dynamically and not pre-set by hand. Or, you could expose some common bounds as drop downs (High, Low, Open, Close, etc.). Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cls71, Today, 04:45 AM
      0 responses
      1 view
      0 likes
      Last Post cls71
      by cls71
       
      Started by mjairg, 07-20-2023, 11:57 PM
      3 responses
      213 views
      1 like
      Last Post PaulMohn  
      Started by TheWhiteDragon, 01-21-2019, 12:44 PM
      4 responses
      544 views
      0 likes
      Last Post PaulMohn  
      Started by GLFX005, Today, 03:23 AM
      0 responses
      3 views
      0 likes
      Last Post GLFX005
      by GLFX005
       
      Started by XXtrader, Yesterday, 11:30 PM
      2 responses
      12 views
      0 likes
      Last Post XXtrader  
      Working...
      X