Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with a Strategy

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

    Help with a Strategy

    Hi, Sorry for the generic title but I just need someone to help me understand why the attached strategy I have written requires 21 days of data loaded when I expect it to require 14. I have three timeframes in the script, 1 Minute, 5 Minute and Daily. The Daily is used to calculate the ATR 14 period and hence I would expect to need 14 days of data loaded but the script won't work with less than 21 days of data. Can you please take a look at the attached .cs file and advise?
    Attached Files

    #2
    Hello, thanks for writing in. This is coming from the weekends being ignored. E.g. if you load 15 days of 1 minute data until today, you will get 12 bars because the weekends are ignored. You can test it out with this code:
    Code:
    if(BarsInProgress == 0)
                {
                    if(Bars.IsFirstBarOfSession)
                    {
                        Print("Minute Series " + CurrentBars[0] + " " + Times[0][0]);
                    }
                }
                if(BarsInProgress == 1)
                {
                    Print("Daily Series " + CurrentBars[1] + " " + Times[1][0]);
                    Print(" ");
                    if(CurrentBars[1] < 14)
                    return;
                    Print("CurrentBar " + CurrentBars[1]);
                    Print("Daily ATR Value " + ATR(BarsArray[1], 14)[0]);
    
                }​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    90 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    137 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
    120 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    71 views
    0 likes
    Last Post PaulMohn  
    Working...
    X