Plotting Last price on the chart


Category:
0
0

Because I rely heavily on support and resistance, I am looking for last price plot that of course will move with the current price. After days or researching for this function I am thinking I need to add this code to the platform. Any help would be appreciated.

RESOLVED
Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on April 11, 2020 11:27 am
112 views
0
Private answer

So I believe what you are requesting is to plot a single horizontal line across the entire chart that matches the close price of the last bar on the chart. If so, then this should do the job:

def lastBar = !IsNaN(close) and IsNaN(close[-1]);
def lastClose = if lastBar then close else 0;
plot lastPrice = HighestAll(lastClose);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 11, 2020 11:49 am
0
I'm not sure what happened but it works!! Thank you so much Pete....
( at April 11, 2020 12:18 pm)
0
Yes, after I saw the question you tried to post as a solution I updated the code to correct the error.
( at April 11, 2020 12:33 pm)
0
Tried to find answer to my question but was unable to. So I am posting it here. On a Heikin Ashi Chart how do I create a line of the last price based on a standard line, candle or chart. The last price on the Heikin Ashi seems to be based on it’s last bar which is not the same as the real last price. I did try the code given above but it it gave the same price as the Heikin Ashi close
( at October 2, 2020 2:24 pm)