Code to operate x days of week and code to operate x months of year

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #153474 quote
    Fran55
    Participant
    Veteran

    I need code, thanks!

    #153476 quote
    Fran55
    Participant
    Veteran

    Example:

    Only operate monday and tuesday, and only operate febrary, april and december.

    #153486 quote
    robertogozzi
    Moderator
    Master

    There you go (add tdmCond to your entry conditions):

    ONCE startT = 000000                                                          //Starting TIME
    ONCE endT   = 240000                                                          //Ending TIME
    TimeRef     = OpenTime                                                        //can be replaced by TIME, if needed
    DayRef      = OpenDayOfWeek                                                   //can be replaced by DAYOFWEEK, if needed
    MonthRef    = OpenMonth                                                       //can be replaced by MONTH, if needed
    //
    td0         = 0 AND DayRef = 0 AND TimeRef >= startT AND TimeRef <= endT      //Sunday
    td1         = 1 AND DayRef = 1 AND TimeRef >= startT AND TimeRef <= endT      //Monday
    td2         = 1 AND DayRef = 2 AND TimeRef >= startT AND TimeRef <= endT      //Tuesday
    td3         = 0 AND DayRef = 3 AND TimeRef >= startT AND TimeRef <= endT      //Wednesday
    td4         = 0 AND DayRef = 4 AND TimeRef >= startT AND TimeRef <= endT      //Thursday
    td5         = 0 AND DayRef = 5 AND TimeRef >= startT AND TimeRef <= endT      //Friday
    td6         = 0 AND DayRef = 6 AND TimeRef >= startT AND TimeRef <= endT      //Saturday
    tdCond      = td0 OR td1 OR td2 OR td3 OR td4 OR td5 OR td6
    //
    m1          = 0 AND MonthRef = 1                                              //January
    m2          = 1 AND MonthRef = 2                                              //February
    m3          = 0 AND MonthRef = 3                                              //March
    m4          = 1 AND MonthRef = 4                                              //April
    m5          = 0 AND MonthRef = 5                                              //May
    m6          = 0 AND MonthRef = 6                                              //June
    m7          = 0 AND MonthRef = 7                                              //July
    m8          = 0 AND MonthRef = 8                                              //August
    m9          = 0 AND MonthRef = 9                                              //September
    m10         = 0 AND MonthRef = 10                                             //October
    m11         = 0 AND MonthRef = 11                                             //November
    m12         = 1 AND MonthRef = 12                                             //December
    mCond       = m1 OR m2 OR m3 OR m4 OR m5 OR m6 OR m7 OR m8 OR m9 OR m10 OR m11 OR m12
    //
    tdmCond     = tdCond AND mCond
    Mauro T. "Algorithm System" thanked this post
    #153643 quote
    Nicolas
    Keymaster
    Master

    @Fran55

    Please explain! better! what! you! need! next! time!!! not the first time you require something without respecting the forum rules!!!! 🙄

    #153690 quote
    Fran55
    Participant
    Veteran

    Ok, ok, ok… but Roberto read the text perfectly.

    And her code is god.

     

    The traductors as a real shit.

    #153726 quote
    nonetheless
    Participant
    Master

    Please explain! better! what! you! need! next! time!!

    Very! funny!

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

Code to operate x days of week and code to operate x months of year


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Fran55 @fran55 Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/12/2020
Status: Active
Attachments: No files
Logo Logo
Loading...