ProRealtime - ProBuilder - PREV like function

FJorge

Newbie
Messages
2
Likes
0
Hi there guys,

I've been doing some coding on ProBuilder (ProRealtime)... I already have some experience on Metastock and I wish to translate some functions I wrote there on to the ProBuilder environment. On Metastock I have the instruction PREV which gives me the previous value of the indicator I'm building, however on ProBuilder I can't find a way to replicate such instruction.

Can anyone knows how I can do this?

Many thanks for an help!
Kind regards,
Fernando
 
Not sure if this will work for your custom indicator, but I know that close[1] , close[2] etc.. returns the close value for the n-1 and n-2 bars, so try: custom_indicator[n]
Cheers
R
 
Not sure if this will work for your custom indicator, but I know that close[1] , close[2] etc.. returns the close value for the n-1 and n-2 bars, so try: custom_indicator[n]
Cheers
R

Hey Rodin,

Thanks for the help. I wasn't able to use the indicator's name, but I did some tests and was able to find a way. Instead of using the indicator's name I used the variable used on the return function. Here's a small example:

Code:
IF (BarIndex<1) THEN
	x=0
ELSE
	// the test is to make this instruction to be always
	// possible to be run.
	// 
	// If x[1] does not exist (for instance at the first
	// bar) the indicator will fail to give any values.

	x=x[1]+1
ENDIF

return x

I don't know if this is the best way to do it... but it seems to work! If anyone knows a better way I would love to see and example. :)

Rodin, thanks again! :)
 
Top