Demark Trendline code

Forums ProRealTime English forum ProBuilder support Demark Trendline code

Viewing 2 posts - 1 through 2 (of 2 total)
  • #239064

    Please help with this code. It is coming up with errors

     

    // Parameters
    lookbackPeriod = 10

    // Number of bars to look back for pivot highs and lows

    // Variables to store pivot points
    pivotHighPrice = 0
    pivotLowPrice = 0

    // Find Pivot High (downtrend)
    for i = 1 to LookbackPeriod do
    if high[i] > high[i+1] and high[i] > high[i-1] then
    pivotHighPrice = high[i]
    break
    endif
    next

    // Find Pivot Low (uptrend)
    for i = 1 to LookbackPeriod do
    if low[i] < low[i+1] and low[i] < low[i-1] then
    pivotLowPrice = low[i]
    break
    endif
    next

    // DeMark Trendline Logic
    // For Uptrend: connecting pivot low to subsequent lower low
    if pivotLowPrice= 0 then
    lineUp =DRAWLINE(pivotLowPrice, Date[pivotLowBar], low, Date[0])
    endif

    // For Downtrend: connecting pivot high to subsequent higher high
    if pivotHighPrice = 0 then
    lineDown = DRAWLINE(pivotHighPrice, Date[pivotHighBar], high, Date[0])
    endif

    RETURN lineUp AS “DeMark Up Trendline”, lineDown AS “DeMark Down Trendline”

    #239067

    DrawLine is a graphical instruction, not to be used in expressions.

    Use:

    and

    Bear in mind that DrawLine (https://www.prorealcode.com/documentation/drawline/) requires BARINDEX1,PRICE1,BARINDEX2,PRICE2 to draw a line between two points.

     

    1 user thanked author for this post.
Viewing 2 posts - 1 through 2 (of 2 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login