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 CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    56 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    34 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    195 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    359 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    281 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X