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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    57 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    78 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    39 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    101 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    61 views
    0 likes
    Last Post PaulMohn  
    Working...
    X