plot open and close on two or more data series

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

plot open and close on two or more data series

Postby arnie » 12 Apr 2013

Hi guys.

I'm stuck again so I'd like some help.
I wrote a pretty basic (I thought) study to plot the open and close over profiles.
When plotted on a single data series the study acts as it should.

Image

But when applied on 2 data series things start to get weird.
In here I have a 30 minute series and a 405 minute series.
The study is applied on the 405 minute.
See how yesterday's open and close are also plotted on today's session.
The idea of having the 30 minute series is to see the bars whenever I want. When the keyboard shortcut for invisible bars is available I will easily toggle between visible and invisible bars.

Image

In here I have the exact same problem.
In here I have a 405 minute and a 930 minute series. One represents the RTH and the other the ETH session.
I use two series so I can color the overnight differently for a better view.
In here I plot the study twice, one applied on the 405 and the other on the 930 series.
The 405 shows the open and close whereas the 930 only shows the close for the last session since I really don't care where previous ETH sessions made their open and close.

Image

Can anyone enlight me in what is going on here?
Here is the code:

Code: Select all

Inputs:
ShowOpen (true),
ShowClose (true),
ShowCloseLastBarOnly (false),
BarStatusData (1),
openColor (rgb(205,102,0)),
upCloseColor (rgb(25,50,124)),
dnCloseColor (rgb(128,0,0));

if ShowOpen then
plot1(open, "open", openColor);

if ShowClose then begin
if close > Open then
plot2(close, "upClose", upcloseColor)
else
plot2(close, "dnClose", dncloseColor);
end;

if ShowCloseLastBarOnly = true then begin
if close > open then
plot3(close, "upLastClose", upcloseColor)
else
plot3(close, "dnLastClose", dncloseColor);

end;

if barstatus(BarStatusData) = 2 then
NoPlot(3);
Attachments
open_close03.png
(20.73 KiB) Downloaded 993 times
open_close02.png
(20.36 KiB) Downloaded 1001 times
open_close01.png
(20.25 KiB) Downloaded 992 times

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

Re: plot open and close on two or more data series

Postby TJ » 12 Apr 2013

The charts are too small; can't see what is going on.
You have to write some notes on the chart to tell us what we are looking at; what is right, and what is wrong. An arrow does not mean much.
You should make a mock up to show what your indicator should produce.

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: plot open and close on two or more data series

Postby arnie » 13 Apr 2013

The charts are too small; can't see what is going on.
You have to write some notes on the chart to tell us what we are looking at; what is right, and what is wrong. An arrow does not mean much.
You should make a mock up to show what your indicator should produce.
Let's try this...

When using a single data series the study plots as expected.
It plots an orange dash indicating the open of the day and a blue/red dash indicating the close/last price of the day.

Image

The problem comes when using two or more data series.
Since we can't playback with volume profile I made the bars visible to show what is happening.
I have a 30 minute series and a 405 data series. The study is being plotted on the 405 minute series. Notice how the previous day's open and close are also being plotted on today's session. Why is this happening? Why the difference between one data series and two data series?

Image

Again, when using a single data series, a 405 minute one, the study isn't plotting the previous day open and close dash into today's session but when using more than one data series the study acts differently, it plots the previous day open and close dash into today's session. Why is that?
It must be the 30 minute series that is making the study to act like this but I can't understand why nor how to fix it.
Attachments
open_close04.png
(40.3 KiB) Downloaded 991 times
open_close05.png
(36.15 KiB) Downloaded 976 times


Return to “User Contributed Studies and Indicator Library”