Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

setting indicator settings in secondary series

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

    setting indicator settings in secondary series

    Hi am i doing it right to set EMA settings for secondary series?
    When i print slowHTFEMA, its not printing correct value according to the secondary added series...
    I keep SlowHTFEMAPeriod in onstatechange

    else if (BarsInProgress == 2)
    slowHTFEMA = EMA(SlowHTFEMAPeriod);
    fastHTFEMA = EMA(FastHTFEMAPeriod);
    baseHTFEMA = EMA(BaseHTFEMAPeriod)​

    if (baseHTFEMA[1] < slowHTFEMA[1]
    {
    go long
    }

    #2
    Hello tkaboris,

    Thank you for your post.

    The default input for an indicator is the BarsInProgress, so your condition that checks if BarsInProgress = 2 should mean that the slowHTFEMA, fastHTFEMA, and baseHTFEMA are set to the second added data series. The primary series would be BarsInProgress 0, the first added series would be BarsInProgress 1, and the second added series would be BarsInProgress 2.

    Otherwise, you could consider using the EMA syntax that allows you to specific the input series:
    EMA(ISeries<double> input, int period)

    For example:
    slowHTFEMA = EMA(BarsArray[2], SlowHTFEMAPeriod);

    For more information on BarsArray:
    We have a page about multi-time frame & instruments scripts here, including a sub-section "Using Bars Objects as Input to Indicator Methods" that is relevant to this topic:Please let us know if we may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    52 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    48 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X