LINE GRAPH BUT BASED ON HIGH/LOW INSTEAD OF CLOSE  [SOLVED]

Questions about MultiCharts and user contributed studies.
krisnara
Posts: 19
Joined: 08 Sep 2020
Been thanked: 1 time

LINE GRAPH BUT BASED ON HIGH/LOW INSTEAD OF CLOSE

Postby krisnara » 08 Oct 2023

I am looking for a single line to be drawn like a Line Graph based on close. However instead of using the close price, the code should plot the high of the bar,if the bar is an UpBar and the low of the bar ,if the bar is a DownBar. So in the end ,all we get is a Single line.I have this working for another platform.In the Picture,the yellow line is the High or Low line and the green line is the closing prices.I have also a attached a picture with OHLC bars to illustrate this concept.
Attachments
HIGHLOW-2.png
(8.35 KiB) Not downloaded yet
HIGHLOW-1.png
(11.47 KiB) Not downloaded yet

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: LINE GRAPH BUT BASED ON HIGH/LOW INSTEAD OF CLOSE

Postby TJ » 09 Oct 2023

What if C = C[1] ?


Try this:

Code: Select all

var: plot.point(0); if C > C[1] then Plot.point = H else if C < C[1] then Plot.point = L; Plot1( Plot.point );

krisnara
Posts: 19
Joined: 08 Sep 2020
Been thanked: 1 time

Re: LINE GRAPH BUT BASED ON HIGH/LOW INSTEAD OF CLOSE

Postby krisnara » 10 Oct 2023

Thanks for the reply.I am getting a compile error though.

------ Compiled with error(s): ------
Unknown Function
line 7, column 0

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: LINE GRAPH BUT BASED ON HIGH/LOW INSTEAD OF CLOSE

Postby TJ » 10 Oct 2023

Thanks for the reply.I am getting a compile error though.

------ Compiled with error(s): ------
Unknown Function
line 7, column 0
Please copy the code and try again.
I have corrected the missing PLOT number.

krisnara
Posts: 19
Joined: 08 Sep 2020
Been thanked: 1 time

Re: LINE GRAPH BUT BASED ON HIGH/LOW INSTEAD OF CLOSE

Postby krisnara » 12 Oct 2023

Thanks Mr TJ. It now works exactly as I needed. Really appreciate your help. I am posting a working picture for benefit of other users.

krisnara
Posts: 19
Joined: 08 Sep 2020
Been thanked: 1 time

Re: LINE GRAPH BUT BASED ON HIGH/LOW INSTEAD OF CLOSE  [SOLVED]

Postby krisnara » 12 Oct 2023

With the picture...
Attachments
HIGH LOW CHAR1.png
(48.5 KiB) Not downloaded yet

krisnara
Posts: 19
Joined: 08 Sep 2020
Been thanked: 1 time

Re: LINE GRAPH BUT BASED ON HIGH/LOW INSTEAD OF CLOSE

Postby krisnara » 19 Oct 2023

Can this be enhanced such that we can give different color options for the Up and Down Waves ?

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: LINE GRAPH BUT BASED ON HIGH/LOW INSTEAD OF CLOSE

Postby TJ » 19 Oct 2023

Go to Wiki
Look under
7 PowerLanguage Keyword Reference
Plotting‎ (15 P)

Look up SetPlotColor


Return to “MultiCharts”