Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Complex parameters / parameters set

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

    Complex parameters / parameters set

    Hi!

    I have an indicator which does some things depending on parameters x, y and z which can be changed in the indicator options by the user.

    There can be multiple parameter "sets" though. How do I implement this?

    So the indicator should do something for example if:

    x = 1 and y = 1 and z = 2

    OR

    x = 1 and y = 1 and z = 3

    OR

    x = 2 and y = 0 and z = 2

    I thought about using files but not sure whether that's a smart idea because the parameters change depending on the stock/instrument.

    I appreciate any ideas. Thanks!

    #2
    Hi Orion, thanks for writing in.

    You can make multiple instances of the same indicator in your script that have different parameters. I attached a example for reference.

    Please let me know if this does not resolve your question.
    Attached Files

    Comment


      #3
      Hi Chris, unfortunately not.

      I don't know how many sets of parameters there are and I also need the parameter values of each set to be checked together.

      Optimally I would be able to loop through "sets of parameters" and execute my logic based on that.

      Thanks for your help!

      Comment


        #4
        Hi Orion, thanks for your reply.

        You can call the indicator "on the fly" within OnBarUpdate and that way you can loop through a set of parameters. Make sure to check that there are at least x bars on the chart where x is the largest lookback period for the indicator e.g.

        OnBarUpdate:

        if(CurrentBar < MaxPeriod)

        for(int i = 10; i < MaxPeriod; i++)
        {
        Print(SMA(i)[0]);
        }

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        77 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X