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

how to get the indicator values in my strategy

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

    how to get the indicator values in my strategy

    i have a indicator that needs 25 bars of daily to process values and plots it in 30 minute timeframe. I use this indicator in my strategy . when i run the bar replay, it takes atleast 5 days of data to be processed before the strategy starts showing up indicator values.
    how can i design it so my indicator values are processed as soon as the real time data flows in.
    i load 25 days of data and have tick replay turned on.

    here is my header for the onbarreplay in strategy
    protected override void OnBarUpdate()
    {

    try{
    if(BarsInProgress>0)
    return;

    if (State != State.Realtime)
    return;



    Here is my indicator header
    protected override void OnBarUpdate()
    {
    try
    {

    if (CurrentBars[0] < 51 || CurrentBars[2] < 22) // bar 0 = 30 minutes, bars 1 = indaily.
    return;

    Print(currTime() + "Got tick from indicator");

    #2
    Hello junkone, thanks for writing in.

    What is the actual issue you are seeing? It looks like the indicator adds a data series with AddDataSeries, is the hosting strategy also adding this data series? This is required in multi time frame scripts that are hosted by other scripts.

    I look forward to hearing from you.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      i am loading a indicator in my strategy that needs 22 daily bars. i have set my data series to load 25 bars but you can see from screenshot, it only loads from dec 14th which may not have 25 trading bars.
      i can also see that there are only 16 daily bars loaded so far on my strategy. i did a print on the number of bars that is recieved on daily timeframe. i connect to fxcm for data and trading.

      Click image for larger version

Name:	33QIouK.png
Views:	155
Size:	155.3 KB
ID:	1135460

      Comment


        #4
        Hello junkone, thanks for your reply.

        Historical tick data is needed to run tick replay, so it is likely you are requesting too much tick data and it is returning the maximum limit. If you load up an indicator with no Tick Replay that only uses Daily bars it would go back much further. You will need to download the tick data or Import it for the current chart to load properly. You may also go into Tools>Options>Market Data> Enable Record Live data as historical. Also, from the screen shot, it looks like your BarsRequiredToPlot property is still set to 20, set this lower if you want the indicator to start plotting earlier.

        Please let me know if I can assist any further.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by helpwanted, Today, 03:06 AM
        0 responses
        3 views
        0 likes
        Last Post helpwanted  
        Started by Brevo, Today, 01:45 AM
        0 responses
        6 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X