Draw Slope on previous Day

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #87458 quote
    rajiwas
    Participant
    Junior
    if DayofWeek >=1  then
    dhp = Dhigh(0)     /// Previous Day High
    angled = sin(9)
    endif
    
    if dhp = dhp then
    bdh = barindex     /// Trying to locate bar for high (error!!!) Pointer 
    endif
    
    
    if Date = Today  then
    if intradaybarindex then     // limiting drawnline to lastbaronly 
    Drawline(bdh,dhp,angled,dhp+angled) Coloured(161,161,161, 93)
    endif
    endif
    
    
    
    
    return
    

    Please help,

    I am trying to auto draw a slope on previous day high at angle but the origin does not index to highest previous day high.
    The barindex does not coordinate to the price when drawn by indicator (Gray line).

    The red line is intended out come, drawn form previous day high manually.

    Any help is appreciated and thanks in anticipation.

    GBPUSD-1-hour-1.png GBPUSD-1-hour-1.png
    #87508 quote
    Nicolas
    Keymaster
    Master

    I think that you wrongly trying to found the barindex of the previous day high, this code should work:

    if DayofWeek >=1 and date<today  then
    dhp = Dhigh(0)     /// Previous Day High
    angled = sin(9)
    if high = dhp then
    bdh = barindex     /// Trying to locate bar for high (error!!!) Pointer
    endif
    endif
    
    if Date = Today  then
    if intradaybarindex then     // limiting drawnline to lastbaronly
    Drawline(bdh,dhp,angled,dhp+angled) Coloured(161,161,161)
    endif
    endif
    
    return barindex,bdh

    I returned the barindex and the founded bdh, try to compare them with the cursor details panel to find if bdh is the correct barindex or not (it should).

    #87511 quote
    rajiwas
    Participant
    Junior

    You are a saviour, thanks alot. I am very grateful for your time and the effort thanks! 🙂

    #87525 quote
    rajiwas
    Participant
    Junior

    Is there away to apply this logic to Find PreviousWeekHigh and its Barindex?

    Thanks

    #88716 quote
    juanj
    Participant
    Master

    You can always use the multi-timeframe functionality to perhaps show both.

    Perhaps also have a look at my topic here: https://www.prorealcode.com/topic/calculating-diagonal-trend-lines-using-fractals-and-trigonometry/

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

Draw Slope on previous Day


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
rajiwas @rajiwas Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by juanj
7 years ago.

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