Vertical Line in every 10days!

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #115016 quote
    crolakstrading
    Participant
    Senior

    Hi All.

    I have managed to code a vertical line to be appear in every 5days.. but is there a way to make this appear in every 10 days.  also on the code the 10 DAYS text to be on top or the bottom of the chart. any help would be much appreciated!

    Thank you in advance

    //DayOfWeek = 1 //0=NO DayOfWeek  1=YES DayOfWeek
    if DayOfWeek = 1 then
    if Time = 010000 then
    atr=averagetruerange[14]
    drawtext("10DAYS",barindex+9,low-atr)coloured(112,169,161)
    DRAWVLINE(barindex)coloured(112,169,161)
    endif
    endif
    return
    
    #115017 quote
    Vonasi
    Moderator
    Master

    Not tested:

    if DayOfWeek = 1 and Time = 010000 then
    if not flag then
    atr=averagetruerange[14]
    drawtext("10DAYS",barindex+9,low-atr)coloured(112,169,161)
    DRAWVLINE(barindex)coloured(112,169,161)
    flag = 1
    else 
    flag = 0
    endif
    endif
    
    return
    crolakstrading thanked this post
    #115018 quote
    Vonasi
    Moderator
    Master

    As for top and bottom of chart there is no defined top or bottom of chart as you cannot know what the maximum and minimum displayed price is to use in an indicator. It would be a nice addition to PRT to be able to retrieve a value for this as you zoom in and out but at the moment it is not possible.

    crolakstrading thanked this post
    #115138 quote
    crolakstrading
    Participant
    Senior

    Thanks very much @vonasi it works fine! 🙂
    i have tried to add a boolean so i can make it appear when ever i want.. but it doesn’t seems be working, what am i doing wrong?

    //DayOfWeek = 1 //0=NO DayOfWeek 1=YES DayOfWeek
    if DayOfWeek = 1 and Time = 010000 then
    if not flag then
    atr=averagetruerange[14]
    drawtext("10DAYS",barindex+9,low-atr)coloured(112,169,161)
    DRAWVLINE(barindex)coloured(112,169,161)
    flag = 1
    else
    flag = 0
    endif
    endif
     
    return
    #115153 quote
    robertogozzi
    Moderator
    Master

    It seems to be working fine. I tested it on DAX 4h.

    x-8.jpg x-8.jpg
    #115163 quote
    Vonasi
    Moderator
    Master

    Your Boolean is a PRT code word and returns the day of week. When you say IF DAYOFWEEK = 1 then it is checking to see that it is a Monday.

    You could try this with an ONOFF boolean (not tested):

    //OnOff = 1 //0 = Display Off 1 = Display On
    
    If OnOff then
    if DayOfWeek = 1 and Time = 010000 then
    if not flag then
    atr=averagetruerange[14]
    drawtext("10DAYS",barindex+9,low-atr)coloured(112,169,161)
    DRAWVLINE(barindex)coloured(112,169,161)
    flag = 1
    else
    flag = 0
    endif
    endif
    endif
    
    return
    crolakstrading thanked this post
    #115171 quote
    robertogozzi
    Moderator
    Master

    Sorry, I misunderstood your question.

    #115250 quote
    crolakstrading
    Participant
    Senior

    Thank you @Vonasi and @robertogozzi
    Just noticed its has changed and it calculates from 9th DEC Monday instead of calculating 16th DEC monday??

    #115253 quote
    crolakstrading
    Participant
    Senior

    why is this not calculationg from 16th monday.. to 10day period?

    #115259 quote
    Vonasi
    Moderator
    Master

    The indicator will start at the left of your chart and look for the first Monday and draw a line there. If time has passed by and your chart only shows 100k bars then the first Monday on the left of the chart will have changed and the line will be drawn on a different set of Mondays to that that it was previously drawn on. This is always going to be an issue when using weird time frames such as 10 days.

    A long time ago we were all discussing a strategy based on 26 seconds and everyone was not surprisingly getting different results depending upon which second they started the strategy on!

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

Vertical Line in every 10days!


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 9 replies,
has 3 voices, and was last updated by Vonasi
6 years, 1 month ago.

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