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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        68 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        151 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        100 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        288 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X