Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using a variable in the Add() funciton

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

    Using a variable in the Add() funciton

    Hi everyone...

    Is is possible to use a variable in the "Add" function? I'd like the instrument in the Add function to use the instrument selected when the strategy is activated. Is that possible?

    // Add a 1-min interval for the current strategy
    Add("ZB 06-09", PeriodType.Minute, 1);

    So... in the above the "ZB 06-09" would have been pulled from the "instrument" field when applying the strategy.

    Thanks,

    Brian

    #2
    Originally posted by heyligerb View Post
    Hi everyone...

    Is is possible to use a variable in the "Add" function? I'd like the instrument in the Add function to use the instrument selected when the strategy is activated. Is that possible?

    // Add a 1-min interval for the current strategy
    Add("ZB 06-09", PeriodType.Minute, 1);

    So... in the above the "ZB 06-09" would have been pulled from the "instrument" field when applying the strategy.

    Thanks,

    Brian
    You just omit that parameter and it will add different time period for instrument currently on the chart
    Add(PeriodType.Minute, 1);

    Comment

    Latest Posts

    Collapse

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