something wrong with dayofweek = 5?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #124729 quote
    jebus89jebus89
    Participant
    Master

    Hello, stumbled upon this weird thing.

    When using the following code i get weird results, K = 1 both thursday and friday, but if i use weekday = 1, 2, 3 or 4, i get K =1 only on that spesific day.

    This is true (for me) on any market.

    More wird stuff,

    dayofweek = 1 gives me k=1 on sundays,

    dayofweek = 2 gives me k=1 on mondays

    dayofweek = 3 gives me k=1 on tuesdays

    Dayofweek = 4 gives me k=1 on wedensdays

    dayofweek = 5 gives me k=1 on thursdays and fridays

    Dayofweek = 6 gives me k=0 always

    Dayofweek = 7 gives me k=0 always

     

    Guessing this is because i have weekend on? Still weird they havnt fixed that so sunday = day 6/7 or at elast split thursday and friday..

    k = 0
    
    if DayOfWeek = 5 then
    k = 1
    elsif dayofweek = not 5 then
    k = 0
    endif
    
    return k
    dayofweek.png dayofweek.png
    #124731 quote
    VonasiVonasi
    Moderator
    Master

    I don’t have this issue. DJI daily on PRTv11.

    Screenshot_1.png Screenshot_1.png
    #124734 quote
    jebus89jebus89
    Participant
    Master

    Can update that the code work in other timeframes, showing k = 1 only on fridays data.. but on daily timeframe it still shows k = 1 on thursday and friday.

    #124735 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I think you’d better use NOT = 5, because you are comparing DayOfWeek with, I guess, 2, since NOT 5 is 2, in binary math:

    5 = 101

    Not 5 = 010 (which is 2)

    or:

    5 = 0101

    Not 5 = 1010 (which is 10)

    I am not sure what kind of comparison PRT make, maybe not just a nibble but the whole byte (which yield 250) , who knows?!

    Or maybe NOT 5 = 0?

    Create this indicator:

    RETURN Not 5

    to see what’s returned.

Viewing 4 posts - 1 through 4 (of 4 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

something wrong with dayofweek = 5?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
jebus89 @jebus89 Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by robertogozzirobertogozzi
6 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/05/2020
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...