Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 12-22-2011, 03:45 AM   #9

Join Date: Aug 2009
Location: rome
Posts: 26
Ignore this user

Thanks: 2
Thanked 7 Times in 6 Posts

Smile Re: What Am I Missing with My Slope Calculation Code ?

Hi onesmith

thanks for asking.

Since you are interested in a recent value of the "direction", you limit your computations to a recent number of price variations ("moves" from a gridline to another). The (k-1) would represent how many latest distinct price changes you are considering to assess the recent "direction".

When you use equispaced gridlines (and do not use weighting), you can just simplify as follows (which is immediately intuitive to visualize):
Code:
              Number of "UpMoves" - Number of "DownMoves"
sdx =     --------------------------------------------------------------------   *  100
                               Number of all "Moves"
intending here "UpMoves", "DownMoves", "Moves" as the distinct price "moves" from a gridline to the adjacent one.

[ The distance between gridlines depends on your "timeframe" (similar to when you measure time, you may be interested in microseconds variations, or you may just be intested in minutes, depending on what you are doing).

(I often use a distance between gridlines equal to 0.1% of the price.) ]

Let me know if something unclear here.


Tom


Quote:
Originally Posted by onesmith »
Tom, I'm trying to translate sdx.
[...]
If i represents an index from 1 to 10 what does k represent? ... a 1 point increment in grid? Can you help me visualize k in the code below?

Code:
for i=1 to 10 begin
    s(i)=p(i)-p(i-1);
end;

Last edited by tommaso; 12-22-2011 at 04:02 AM.
tommaso is offline  
Reply With Quote
The Following User Says Thank You to tommaso For This Useful Post:
Do Or Die (12-22-2011)

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slope of MACD Calculate Angle v101 Technical Analysis 7 07-13-2010 04:33 AM
MA Slope PeterBrazel Coding Forum 4 08-18-2009 12:05 AM
Tick Size Calculation PeterBrazel Coding Forum 1 08-17-2009 08:55 PM
MA Slope PeterBrazel Coding Forum 19 07-05-2009 11:27 PM
Determine Slope End or Start januson Technical Analysis 11 11-20-2008 04:39 PM

All times are GMT -4. The time now is 11:11 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.