Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by funk10101, Today, 09:43 PM
    0 responses
    4 views
    0 likes
    Last Post funk10101  
    Started by pkefal, 04-11-2024, 07:39 AM
    11 responses
    36 views
    0 likes
    Last Post jeronymite  
    Started by bill2023, Yesterday, 08:51 AM
    8 responses
    44 views
    0 likes
    Last Post bill2023  
    Started by yertle, Today, 08:38 AM
    6 responses
    26 views
    0 likes
    Last Post ryjoga
    by ryjoga
     
    Started by algospoke, Yesterday, 06:40 PM
    2 responses
    24 views
    0 likes
    Last Post algospoke  
    Working...
    X