Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DataSeries as Input for Indicator with CalculateOnBarClose = false

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

    DataSeries as Input for Indicator with CalculateOnBarClose = false

    Hi,

    I have problems creating an indicator that updates properly if used with CalculateOnBarClose = false.

    Basically I modified a Stochastics to use different smoothing MA's:

    Code:
     
    K.Set(kValue); // Smooth = SlowKperiod
     
     
    switch (smoothType)
    {
    case 1:
    dValue = EMA(K, PeriodD)[0];
    break;
    case 2:
    dValue = InstTrend(K, PeriodD)[0];
    break;
    default:
    dValue = SMA(K, PeriodD)[0];
    break;
    }
    D.Set(dValue); // PeriodD = SlowDperiod
    where InstTrend is my own indicator and K is basically
    the DataSeries to be smoothed.
    If I use CalculateOnBarClose = true everything works fine with all three indicators. Input has these values for example:

    CurrentBar=2838: Input[0]: 13.3333,: Input[1]: 18.75, : Inpu[2]:23.5294
    CurrentBar=2839: Input[0]: 18.75, : Input[1]: 13.3333, : Input[2]: 18.75
    CurrentBar=2840: Input[0]: 31.25, : Input[1]: 18.75, : Input[2]: 13.3333

    ES:
    When using CalculateOnBarClose = false, the current value for K does not get passed on to the InstTrend Indicator and therefore the computations will be false:

    CurrentBar=2838: Input[0]: 0, : Input[1]: 18.75, : Input[2]: 23.5294
    CurrentBar=2839: Input[0]: 0, : Input[1]: 13.3333, : Input[2]: 18.75
    CurrentBar=2840: Input[0]: 0, : Input[1]: 18.75, : Input[2]: 13.3333
    CurrentBar=2841: Input[0]: 0, : Input[1]: 31.25, : Input[2]: 18.75

    However the system indicators EMA and SMA as well use Input[0] and do not seem to have any problems, even under tick by tick processing.

    What is missing?
    Last edited by cbaer; 01-13-2009, 08:16 PM.

    #2
    Hi cbaer, please try removing all CalculateOnBarClose calls in the dependent scripts / methods and use only one call in the final indicator.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    599 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    344 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    558 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    557 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X