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

parameter order when calling indicators

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

    parameter order when calling indicators

    I have just discovered what seems to me to be an anomaly. I have created an indicator with four parameters, C, D, B and A. They are listed in the variables in that order and are in the same order in the Properties region. However, when I call the indicator from within a strategy I have found that I must specify the parameters in a different order, viz MyInd(A,B,C,D). After many hours of head scratching and experimenting I finally figured out that the parameters must be in alphabetical order of the indicator parameter names for the call to the indicator (and the parameter names used in the call can be in any order). Is this correct?

    Since the names can be completely different in the strategy and the indicator I always assumed the mapping was positional, i.e. the first parameter specified in the call was mapped to the first parameter specified in the indicator, and so on, but this appears to not be the case. Instead it seems the parameters in the call must be listed in the alphabetical order of the parameter names in the indicator. It seems to me this could be a recipe for disaster. If you ever decided to rename any parameters in your indicator, you could inadvertently alter the parameter call sequence, which means (if you noticed it...) you would have to change every call to the indicator in every strategy that uses it.

    Wouldn't it be a heck of a lot easier to map the parameters by position than by name? From my limited understanding of programming, I thought that was pretty standard. It might make it a bit easier to list the parameters in the order defined rather than alphabetical in all the other places that people have been complaining about (like the strategy window) rather than having to use \t or adding a prefix to the parameter name.

    Thanks,
    Ian

    #2
    Ian, thanks for the feedback - correct the parameters are internally ordered alphabetically, this is expected behavior.
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ETFVoyageur, Today, 04:00 PM
    2 responses
    9 views
    0 likes
    Last Post ETFVoyageur  
    Started by dward123, 01-02-2024, 09:59 PM
    3 responses
    162 views
    0 likes
    Last Post bjunaid
    by bjunaid
     
    Started by AaronKTradingForum, Today, 03:44 PM
    1 response
    8 views
    0 likes
    Last Post AaronKTradingForum  
    Started by Felix Reichert, 04-26-2024, 02:12 PM
    11 responses
    77 views
    0 likes
    Last Post Felix Reichert  
    Started by junkone, 04-28-2024, 02:19 PM
    7 responses
    83 views
    1 like
    Last Post junkone
    by junkone
     
    Working...
    X