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

Assign property Indicator Property in Strategy

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

    Assign property Indicator Property in Strategy

    Team,

    I have declared a below property/parameter in Indicator

    [Display(Description = "", GroupName = "Parameters", Name = "Base Param1", Order = 1)]
    [Range(1, 2147483647)]
    public int BaseParam1 { get; set; }


    In Strategy, I would like to assign value to this parameter. How can I do it?
    Can I do it through Wizard or through code?


    #2
    Hello surya,

    Thank you for your post.

    Setting the value for the indicator property within a strategy could be accomplished by adding the indicator to your strategy. Then, assigning a value for the indicator property.

    For example, if we have an indicator called MyCustomIndicator and a strategy called MyCustomStrategy, we would add the indicator to the strategy. The code would look something like this.

    private MyCustomIndicator myCustomIndicator;

    Then, we could assign a value to the indicator parameter within the OnBarUpdate() method of the strategy. This would look something like myCustomIndicator.BaseParam1 = 10;

    See the attached example script that demonstrates this.

    Please note that this would not be possible to accomplish in the Strategy Builder. You would need to unlock your code from the Strategy Builder to accomplish this.

    Let us know if we may assist further.
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by algospoke, Yesterday, 06:40 PM
    2 responses
    23 views
    0 likes
    Last Post algospoke  
    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
    45 views
    0 likes
    Last Post jeronymite  
    Started by Barry Milan, Yesterday, 10:35 PM
    7 responses
    22 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by AttiM, 02-14-2024, 05:20 PM
    10 responses
    181 views
    0 likes
    Last Post jeronymite  
    Working...
    X