Exclude last week from indicator calculation?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #110457 quote
    robdav
    Participant
    Veteran

    I’m trying to write an indicator that excludes the last 5 days of data from the calculation but I can’t seem to work.

    Experimenting with the output from TODAY, YESTERDAY and DAY in PRT 11.1 attached is what I get, this doesn’t seem correct to me. Can someone explain what I’m missing or help me code how to exclude the last x days please?

    DEFPARAM drawonlastbaronly=True
    
    TODAYTEST1 = TODAY[1]
    TODAYTEST2 = TODAY[2]
    drawtext("TODAY[1]:  #TODAYTEST1#",barindex-100,+0.4,monospaced,standard,14) coloured(255,0,0)
    drawtext("TODAY[2]:  #TODAYTEST2#",barindex-100,+0.3,monospaced,standard,14) coloured(255,0,0)
    
    DAYTEST1 = DAY[1]
    DAYTEST2 = DAY[2]
    drawtext("DAY[1]:  #DAYTEST1#",barindex-100,0.0,monospaced,standard,14) coloured(255,0,0)
    drawtext("DAY[2]:  #DAYTEST2#",barindex-100,-0.1,monospaced,standard,14) coloured(255,0,0)
    
    
    YESTERDAYTEST1 = YESTERDAY[1]
    YESTERDAYTEST2 = YESTERDAY[2]
    drawtext("YESTERDAY[1]:  #YESTERDAYTEST1#",barindex-100,-0.4,monospaced,standard,14) coloured(255,0,0)
    drawtext("YESTERDAY[2]:  #YESTERDAYTEST2#",barindex-100,-0.5,monospaced,standard,14) coloured(255,0,0)
    
    RETURN

    Thanks

    Rob

    today_etc_test.jpg today_etc_test.jpg
    #110500 quote
    Nicolas
    Keymaster
    Master

    TODAY and YESTERDAY return dates in YYYYMMDD format. But the text is truncated because it exceeds million.

    To get the complete number, you can try to multiply the date by 1.000.000: (YESTERDAY[1]*1000000)

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

Exclude last week from indicator calculation?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
robdav @robdav Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
6 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/18/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...