How to get the next day

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #188400 quote
    MacroTMacroT
    Participant
    Average

    Hi,

     

    In BackTesting and Auto Trading I am building a system and have an input that I have defined to contain multiple dates, say it contains 10 different dates .

    I am interested in the next day working day after each of those dates. How can I get this from the pre defined string of original dates?

     

    Thanks

    #188409 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go:

    $MyDate[1]  = 20210918
    $MyDate[2]  = 20211010
    $MyDate[3]  = 20211019
    $MyDate[4]  = 20211107
    $MyDate[5]  = 20211201
    $MyDate[6]  = 20211217
    $MyDate[7]  = 20211225
    $MyDate[8]  = 20220108
    $MyDate[9]  = 20220122
    $MyDate[10] = 20220206
    CurDate     = Date       //or use OpenDate if you need the date at the opening of a bar, instead of that at the closing of a bar
    NextDate    = 0          //defaults to an invalid date
    FOR i = 1 TO 10
       IF (CurDate > $MyDate[i]) AND (CurDate[1] <= $MyDate[i]) THEN
          NextDate = CurDate //NextDate will retain the valid date
          Break
       ENDIF
    NEXT
    buy at -close limit      //useless action, but to comply with PRT's requirements
    graph NextDate > 0       //plots TRUE logic value when a valid date is found
    #188416 quote
    MacroTMacroT
    Participant
    Average

    Thanks – I will give this a go

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

How to get the next day


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
MacroT @macrot Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by MacroTMacroT
4 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/17/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...