Announcement

Collapse
No announcement yet.

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.

    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:	204
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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        93 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        138 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        123 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        73 views
        0 likes
        Last Post PaulMohn  
        Working...
        X