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

Notification

Icon
Error

Options
Go to last post Go to first unread
xumitcap  
#1 Posted : Tuesday, March 26, 2013 5:18:38 AM(UTC)
xumitcap

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 3/26/2013(UTC)
Posts: 4

Please help me with the codes:

For the 20 days window period, I want to take average of last 10 days (including today's close) subtracted by average of previous 10 days.

Ave(Day11 to Day20) - Ave (Day1 to Day10)
mstt  
#2 Posted : Tuesday, March 26, 2013 1:43:23 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)

If I understand you correctly your "Ave(Day11 to Day20) - Ave (Day1 to Day10)" could be written like this.

Ref(Mov(C,10,S),-10) - Mov(C,10,S);

However, it could be that I have the two expressions back to front, in which case it could look like this.

Mov(C,10,S) - Ref(Mov(C,10,S),-10);

Either line of code could be shortened by a few characters by defining the 10-period moving average first and then performing the subtraction..

M:=Mov(C,10,S);
Ref(M,-10) - M;

Roy

eddie.m  
#3 Posted : Tuesday, March 26, 2013 8:08:00 PM(UTC)
eddie.m

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/20/2012(UTC)
Posts: 152

Was thanked: 1 time(s) in 1 post(s)
xumitcap wrote:
Please help me with the codes:

For the 20 days window period, I want to take average of last 10 days (including today's close) subtracted by average of previous 10 days.

Ave(Day11 to Day20) - Ave (Day1 to Day10)

Hi xumit, [:)]

You can do it in several ways:

BEGINNER, it helps you focus step by step

Code:
a:=(Mov(C,10,S)+
Ref(Mov(C,10,S),-1)+
Ref(Mov(C,10,S),-2)+
Ref(Mov(C,10,S),-3)+
Ref(Mov(C,10,S),-4)+
Ref(Mov(C,10,S),-5)+
Ref(Mov(C,10,S),-6)+
Ref(Mov(C,10,S),-7)+
Ref(Mov(C,10,S),-8)+
Ref(Mov(C,10,S),-9))/10;
b:=(Ref(Mov(C,10,S),-11)+
Ref(Mov(C,10,S),-12)+
Ref(Mov(C,10,S),-13)+
Ref(Mov(C,10,S),-14)+
Ref(Mov(C,10,S),-15)+
Ref(Mov(C,10,S),-16)+
Ref(Mov(C,10,S),-17)+
Ref(Mov(C,10,S),-18)+
Ref(Mov(C,10,S),-19)+
Ref(Mov(C,10,S),-20)
)/10;
a-b

INTERMEDIATE, here you want to play with formulas you learnt (but which you didn't [:O]) in MS User Manual and Formula Primer

Code:
a:=Sum(Mov(C,10,S),10)/10;
b:=Ref(Sum(Mov(C,10,S),10),-11)/10;
a-b

ADVANCED, the simplest formula but the ugliest line (Attention: some people post bad codes in these threads [6]) The values are different from the other two Indicators above, and it gives earlier price/SMA crossover signals.

Code:
M:=Mov(C,10,S);
M-Ref(M,-11)

(Observe -11, instead of -10).

There is no point in subtracting the front SMA batch from the back SMA batch.

Ave(Day11 to Day20) - Ave (Day1 to Day10).
It is much better the other way round:
Ave (Day1 to Day10) - Ave(Day11 to Day20)
What are you after with this Indicator? [:D]
xumitcap  
#4 Posted : Wednesday, March 27, 2013 10:18:30 PM(UTC)
xumitcap

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 3/26/2013(UTC)
Posts: 4

Thanks Roy for your help. Really appreciate it.
xumitcap  
#5 Posted : Thursday, March 28, 2013 12:17:21 AM(UTC)
xumitcap

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 3/26/2013(UTC)
Posts: 4

Thanks Ed. You really did more than bit to help me.

In Van Tharp book, he spoke about Velocity and Acceleration studies. For 20d lookback period, he would employ ((C-Ref(C,-19))/20 for velocity change. I was thinking that instead of taking a particular days, I can employ (Ave(11 to 20days) - Ave(1 to 10days))/20 for a smoother sinusoidal cycles.
eddie.m  
#6 Posted : Thursday, March 28, 2013 5:21:15 AM(UTC)
eddie.m

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/20/2012(UTC)
Posts: 152

Was thanked: 1 time(s) in 1 post(s)
xumitcap wrote:
Thanks Ed. You really did more than bit to help me.

In Van Tharp book, he spoke about Velocity and Acceleration studies. For 20d lookback period, he would employ ((C-Ref(C,-19))/20 for velocity change. I was thinking that instead of taking a particular days, I can employ (Ave(11 to 20days) - Ave(1 to 10days))/20 for a smoother sinusoidal cycles.
Hi xumit,
In your initial post you did not mention /20. [:)]
Your formula is in fact
Code:
(C-Ref(C,-19))/20
1). First, if you already are a profitable trader, improve on your existing system with money management rules. Your effort should be to win more when you win, and lose less when you lose.
2). Looking for something new is what all of us do. Paper trade everything you found until you understand how the details influence the system. Only AFTER that, trade it with small capital to see what more irregularities you will come across. Then you'll take from there.
3). Did you run searches on the Net on Velocity and Acceleration before you attempted to write your own code?
4). Let us know if it works for you. [:)]
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.