logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Leverage  
#1 Posted : Friday, March 5, 2010 8:41:14 AM(UTC)
Leverage

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 1/25/2010(UTC)
Posts: 44
Location: Rome, IT

Hi guy!
I'm writing an indicator and I want to know how getting a variable value at the previous bar.
Example:
if I want a dummy indicator the plot 1,0,1,0,1,0,1,0,1,0 for all the bar,
I need to know if at previous bar the indicator plotted 1 or 0
v.trader  
#2 Posted : Friday, March 5, 2010 9:33:37 AM(UTC)
v.trader

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/26/2009(UTC)
Posts: 76
Location: Toronto, Canada

Have you tried using PREV?
Leverage  
#3 Posted : Friday, March 5, 2010 10:07:28 AM(UTC)
Leverage

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 1/25/2010(UTC)
Posts: 44
Location: Rome, IT

I didn't use it.
Can you explain me an easy example on how to use it?

Tnx
v.trader  
#4 Posted : Friday, March 5, 2010 10:31:36 AM(UTC)
v.trader

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/26/2009(UTC)
Posts: 76
Location: Toronto, Canada

http://forum.equis.com/forums/thread/31267.aspx I'm not sure that PREV should be use though. I will try writing the code for your dummy indicator, but now I have to go to work so if I am able to code it I will post it later on today. VT
v.trader  
#5 Posted : Friday, March 5, 2010 10:34:55 AM(UTC)
v.trader

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/26/2009(UTC)
Posts: 76
Location: Toronto, Canada

The code for the dummy is (type into your indicator builder): x=1; y:= x - PREV; y; You can see how prev uses the last result. You can build some useful indicators with prev.
Leverage  
#6 Posted : Friday, March 5, 2010 11:52:18 AM(UTC)
Leverage

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 1/25/2010(UTC)
Posts: 44
Location: Rome, IT

Tnx v.trader,
now I will try it
wabbit  
#7 Posted : Friday, March 5, 2010 6:11:11 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Instead of using the slow PREV (recursive) function, think a little more logically; try this:

Code:

mod(cum(1),2)=0;



wabbit [:D]

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.