Profit target line auto draws

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #114318 quote
    kekskeks
    Participant
    Average

    Hi,

    I would like to explore the possibility to visually view profit target using a simple SuperTrend indicator on ProRealtime. In the chart when price changes the trend (orange dots go green for instance), I would like a horizontal line drawn at for example 5atr above in case trend is up. when price touches this line I would like another line to be drawn 5atr above and so on until the trend changes. When a new line is drawn I would like the previous line to stop being drawn. I have attached a sample where I have manually drawn white segments the way I would like them to show up. The lower chart in aqua is ATRcustom simply ATR(14)*5.

    Thanks!

    chart.png chart.png
    #114324 quote
    NicolasNicolas
    Keymaster
    Legend

    Here is the code to plot the target takeprofit levels as you described:

    st=Supertrend[3,10]
    
    iatr=AverageTrueRange[14](close)*5
    if close crosses over st or close crosses over level  then 
    startbar=barindex
    level = close+iatr
    elsif close crosses under st or close crosses under level then 
    startbar=barindex
    level = close-iatr
    endif
    
    offset = max(1,barindex-startbar)
    
    
    drawsegment(barindex[offset],level,barindex,level)
    
    return
    keks thanked this post
    supertrend-target-levels.png supertrend-target-levels.png
    #114339 quote
    kekskeks
    Participant
    Average

    Amazing!

    Looks exactly like I wished. Many many thanks!

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

Profit target line auto draws


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
keks @keks Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by kekskeks
6 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/06/2019
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...