Announcement

Collapse
No announcement yet.

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
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    80 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
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X