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

Notification

Icon
Error

Options
Go to last post Go to first unread
klim  
#1 Posted : Monday, January 28, 2013 2:22:02 PM(UTC)
klim

Rank: Newbie

Groups: Registered, Registered Users
Joined: 12/4/2012(UTC)
Posts: 7

Hello friends. I have an indicator

If (Mov (C-Ref (C, -5), 610, E)> (Mov ((Ref (C, -1)-Ref (C, 1)), 610, E)), 1, -1)

I want to build on this indicator centered moving averages.That is, instead of exponents use the centered moving averages Formula centered moving averages:

fwPds:=Input("Forward-referencing periods (automatic = -1)",-1,2600,- 1);

proj:=Input("Project last known MA: [1]Direction, [2]Value",1,2,1);

pds:=Input("Mov Avg periods",1,2600,21);

type:=Input("[1]EMA [2]SMA [3]TmSr [4]Tri [5]Var [6]Vol [7]Wght",1,7, 2);

{ Choose MovAvg type: 1 - Exponential MA 2 - Simple MA 3 - Time Series MA 4 - Triangular MA 5 - Variable MA 6 - Volume adjusted MA 7 - Weighted MA } ma:= If(type=1,Mov(C,pds,E), If(type=2,Mov(C,pds,S), If(type=3,Mov(C,pds,T), If(type=4,Mov(C,pds,TRI), If(type=5,Mov(C,pds,VAR), If(type=6,Mov(C,pds,VOL), Mov(C,pds,W)))))));

{ Automatic period-centering } center:=LastValue(If(fwPds<0,Int(pds/2),fwPds));

{ Forward-referenced MovAvg } fwd:=Ref(ma,center);

{ Last valid MovAvg plot point } lastVal:=IsUndefined(fwd) AND Alert(IsUndefined(fwd)=0,2); { Extend MovAvg plot into future null zone } xtend:=LastValue(fwd+PREV-PREV);

{ Restrict invalid initial MovAvg plot } movAvg:=Ref(Ref(xtend,pds-1),-pds+1);

{ Last MA known direction & future projection } init:=Cum(IsDefined(movAvg))=1; direction:=movAvg+ ( ValueWhen(1,init OR lastVal,Ref(movAvg,-1)) -ValueWhen(1,init OR lastVal,Ref(movAvg,-2))) *(BarsSince(init OR lastVal)+1);

{ Plot MovAvg on price chart } If(proj=1,direction,movAvg)

I do not really know a programming language, so please help. Maybe others too need - will enjoy.

wabbit  
#2 Posted : Monday, January 28, 2013 3:53:38 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)
When you post code to the forum, please use the proper code tags so that readers can easily identify code from text.

When you post someone else's work, please leave their headers and other information intact.

Please have a look at the many discussions on the forum regarding centering averages, and the fact they use forward referencing and hence are of extremely limited use in real life trading.

If you don't know the MS formula language, then read the MS User Manual and then do the basic exercises in the free Equis Formula Primer.



wabbit [:D]
klim  
#3 Posted : Tuesday, January 29, 2013 12:44:18 AM(UTC)
klim

Rank: Newbie

Groups: Registered, Registered Users
Joined: 12/4/2012(UTC)
Posts: 7

centered moving average formula I picked up on this forum. So what, someone help?
wabbit  
#4 Posted : Tuesday, January 29, 2013 1:15:30 AM(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)
Do you want "help" i.e. assistance, or do you want someone to give their time to do the work for you? Where is your effort to attempt this simple task yourself? There are no slaves around here to spoon-feed you, but there are plenty of people willing to help you after you put in some effort to help yourself first.

Why do you want someone to explain just for you the problems with forward referencing when so much has already been written on the topic; information easily found with a simple search of the forum? Just because there is some code to be found on this or any other forum doesn't mean that code is useful or safe to trade.


wabbit [:D]


cracker  
#5 Posted : Thursday, January 31, 2013 8:41:10 PM(UTC)
cracker

Rank: Newbie

Groups: Registered, Registered Users
Joined: 5/19/2006(UTC)
Posts: 7

Was thanked: 1 time(s) in 1 post(s)
how did you go with the centered moving avg
Users browsing this topic
Guest (Hidden)
Similar Topics
centered moving average and the null zone (Basic Coding Techniques)
by molfetta 7/20/2007 8:38:03 AM(UTC)
Centered Moving Average - v3.0 (Formula Assistance)
by StorkBite 9/2/2005 12:16:20 AM(UTC)
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.