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

Reply
Old 04-06-2010, 10:34 AM   #1

Join Date: Oct 2006
Location: na
Posts: 307
Ignore this user

Thanks: 33
Thanked 89 Times in 58 Posts

Median in Easylanguage

Was trying to find an easy way to find the median of a given set of numbers. I've searched the pdf files that are available and the only thing remotely close was related to activity bars, so that didnt really help.

anyone got an ideas?
trader273 is offline  
Reply With Quote
Old 04-06-2010, 10:52 AM   #2

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,477 Times in 912 Posts

Re: Median in Easylanguage

there is a function named medianprice.

it is simply ( H + L ) / 2
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
The Following User Says Thank You to Tams For This Useful Post:
trader273 (04-06-2010)
Old 04-06-2010, 10:54 AM   #3

Join Date: Oct 2006
Location: na
Posts: 307
Ignore this user

Thanks: 33
Thanked 89 Times in 58 Posts

Re: Median in Easylanguage

ok, i guess its just median( )
duh

Then I guess what I don't understand is how to get the median of a set of numbers I have.

If anyone reads Dr.Steenbarger's blog he showed what he uses for price projections, and I was trying to code something up. I have five variables and I need to take the median of those 5.
trader273 is offline  
Reply With Quote
Old 04-06-2010, 10:55 AM   #4
zdo

Join Date: Nov 2007
Location: boonies
Posts: 1,349
Ignore this user

Thanks: 317
Thanked 355 Times in 256 Posts
Blog Entries: 104

Re: Median in Easylanguage

The Median (or MedianArray) function won't work for you?
zdo is offline  
Reply With Quote
The Following User Says Thank You to zdo For This Useful Post:
trader273 (04-06-2010)
Old 04-06-2010, 11:01 AM   #5

BlowFish's Avatar

Join Date: Mar 2007
Location: In Da House
Posts: 3,292
Ignore this user

Thanks: 129
Thanked 1,054 Times in 702 Posts

Re: Median in Easylanguage

There is some good background here Selection algorithm - Wikipedia, the free encyclopedia.

Are you actually talking about price data arriving in real time? That's a wee bit tricky. Trouble with EL is that it's not great for more complex data structures. You could probably sort data into an array as it arrived. Whilst not difficult a bit fiddly.

Median is the mid price in a sorted set of numbers right? (not the mid price).
BlowFish is offline  
Reply With Quote
The Following User Says Thank You to BlowFish For This Useful Post:
trader273 (04-06-2010)
Old 04-06-2010, 11:14 AM   #6

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,477 Times in 912 Posts

Re: Median in Easylanguage

Quote:
Originally Posted by trader273 »
ok, i guess its just median( )
duh

Then I guess what I don't understand is how to get the median of a set of numbers I have.

If anyone reads Dr.Steenbarger's blog he showed what he uses for price projections, and I was trying to code something up. I have five variables and I need to take the median of those 5.
you have to use the medianarray

first, create an array,
then put the 5 numbers in the array,
then use medianarray to interrogate the array for the median.
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
The Following User Says Thank You to Tams For This Useful Post:
trader273 (04-06-2010)
Old 04-06-2010, 11:55 AM   #7

Join Date: Oct 2006
Location: na
Posts: 307
Ignore this user

Thanks: 33
Thanked 89 Times in 58 Posts

Re: Median in Easylanguage

Ok, I gave this my best shot. I have never used arrays, so this is fun

I searched through TL and some other pdf's.

Here is what I got so far:

Code:
Array:
MyArray[5](0);
ArrayElement[1]=((yesthi-yestlo)/yestop)*100;
ArrayElement[2]=((H2-L2)/O2)*100;
ArrayElement[3]=((H3-L3)/O3)*100;
ArrayElement[4]=((H4-L4)/O4)*100;
ArrayElement[5]=((H5-L5)/O5)*100;

V=MedianArray(myArray,5);

I have everything defined, and it plots correctly. The error I got is "Index was outsite the bounds of the array"

Googled that, and I thought I fixed it but not so much. Probably missing something easy...
trader273 is offline  
Reply With Quote
Old 04-06-2010, 12:03 PM   #8

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,477 Times in 912 Posts

Re: Median in Easylanguage

Code:
Array:
MyArray[6](0);

MyArray[1] = ((yesthi-yestlo)/yestop)*100;
MyArray[2] = ((H2-L2)/O2)*100;
MyArray[3] = ((H3-L3)/O3)*100;
MyArray[4] = ((H4-L4)/O4)*100;
MyArray[5] = ((H5-L5)/O5)*100;

Value1 = MedianArray(myArray,6);

array numbering starts with zero,
but medianarray referencing begins with array element 1.
therefore you need an array of 6 to handle 5 numbers.
__________________



Only an idiot would reply to a stupid post

Last edited by Tams; 04-06-2010 at 12:11 PM.
Tams is offline  
Reply With Quote
The Following User Says Thank You to Tams For This Useful Post:
trader273 (04-06-2010)

Reply

Tags
array, median

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
Easylanguage Partner Market Wizard Coding Forum 1 05-19-2012 04:51 PM
Trendline (EasyLanguage) Tams Coding Forum 43 07-09-2011 12:36 AM
Antonio: Please help me on MP for easylanguage nasdaq5048 Market Profile 13 09-23-2010 09:50 AM
Some EasyLanguage Help Please jjthetrader Coding Forum 8 06-02-2008 04:20 PM
Andrews Pitchfork (Median Line) justcatalin Market Analysis 16 04-06-2008 03:44 AM

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