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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X