Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator calculate OnEachTick instantiating indicator OnBarClose

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

    Indicator calculate OnEachTick instantiating indicator OnBarClose

    Hi everyone,
    Lets say I have MyFirstIndicator and MySecondIndicator as follows.

    -----------------------
    if (State == State.SetDefaults)
    {
    ...
    Name = "MyFirstIndicator";
    Calculate = Calculate.OnBarClose;
    ...
    }

    -----------------------
    -----------------------
    if (State == State.SetDefaults)
    {
    ...
    Name = "MySecondIndicator";
    Calculate = Calculate.OnEachTick;
    ...
    }​
    else if (State == State.DataLoaded)
    {
    ...
    MyFirstIndicator1 = MyFirstIndicator(......);
    ...
    }​​
    -----------------------
    -----------------------

    MySecondIndicator must calculate OnEachTick. This one, instantiates MyFirstIndicator which must calculate OnBarClose. Both are set like that in State.SetDefaults

    I figured out that despite I set the calculation mode as it should be for each both indicators, when I run MySecondIndicator, because it is calculating OnEachTick, overrides the calculation of MyFirstIndicator doing so OnEachTick also.

    Is it possible to force in any way the calculation for each indicator as I want?


    Many thanks in advance for your support.

    #2
    Hello germanf,

    What you are seeing is normal, the host will force the hosted scripts to calculate the same as the host. To simulate OnBarUpdate you would need to change the first indicators logic to use FirstTickOfBar



    You can also do like the BuySellPressure indicator does in its logic to simulate bar closes.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    368 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    571 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X