[PL] Daily"ohlc"

Questions about MultiCharts and user contributed studies.
duration
Posts: 175
Joined: 20 Dec 2005

[PL] Daily"ohlc"

Postby duration » 25 Mar 2010

Dear All,

How can you ask powerlanguage to give you the highest high, lowest low, open and close of the previous day?

dailyhigh(0), dailylow(0) etc. do not seem to work.

I am trying to programme trendlines for pivot points..

Many thanks,

User avatar
Bruce DeVault
Posts: 438
Joined: 19 Jan 2010
Location: Washington DC
Been thanked: 2 times
Contact:

Postby Bruce DeVault » 25 Mar 2010

Take a look at the functions OpenD, HighD, LowD and CloseD if you are using intraday data. That is what they do. Or, you can write something that does this by simply watching when date <> date[1] and keeping track of it in a few lines of code (see how the functions above work for an example of how.)

duration
Posts: 175
Joined: 20 Dec 2005

Postby duration » 25 Mar 2010

Dear Bruce,

Thank you for your reply. This is what I was looking for.

I use the following to calculate the pivot point:

Code: Select all

var0 = ( HighD( 1 ) + LowD( 1 ) + CloseD( 1 ) ) / 3;
plot1( var0, "Pivot Point" );


But var0 returns 1 and sends the candlesticks high up the window.

Is there anything wrong in this code?

Many thanks,

User avatar
Bruce DeVault
Posts: 438
Joined: 19 Jan 2010
Location: Washington DC
Been thanked: 2 times
Contact:

Postby Bruce DeVault » 25 Mar 2010

Perhaps you are referring to the fact that the functions return -1 when on the first date, and thus there isn't any previous date's information to return. The average of three numbers all of which are -1 is still -1. You simply need to check for this.

Code: Select all

variables: var0(0);
var0 = ( HighD( 1 ) + LowD( 1 ) + CloseD( 1 ) ) / 3;
if var0 > 0 then plot1( var0, "Pivot Point" );

duration
Posts: 175
Joined: 20 Dec 2005

Postby duration » 25 Mar 2010

Dear Bruce,

Thank you for your reply.

Unfortunately, nothing it displayed at all when I use your suggestion, it is like var0 is never greater than 0.

I wonder why...

User avatar
Bruce DeVault
Posts: 438
Joined: 19 Jan 2010
Location: Washington DC
Been thanked: 2 times
Contact:

Postby Bruce DeVault » 25 Mar 2010

Do you have more than one day of data on your chart? It will have a value after the first day of data.

duration
Posts: 175
Joined: 20 Dec 2005

Postby duration » 25 Mar 2010

Dear Bruce,

Yes, I have more than 100 days.

Its is intraday data, 5 points chart.

Many thanks,

User avatar
TJ
Posts: 6598
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1909 times

Postby TJ » 25 Mar 2010

the best pivot study ever:

ABC_Floor Trader Pivots V3
http://forum.tssupport.com/viewtopic.php?t=4542



@ PLEditor, use FILE > IMPORT

duration
Posts: 175
Joined: 20 Dec 2005

Postby duration » 25 Mar 2010

Thank you TJ, this is just awesome!

There is much for me to learn in there.


Return to “MultiCharts”