Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() i'm trying to come up with a formula that will calculate the distance between the peaks and troths in the fluctuations of these currency prices. i've only been studying vba programming for a week so i don't have the know-how to write the algorithm but here is how i imagine it would be done. each wave must be at least 33 pips (a pip is one hundredth of a cent) long. so the wave must extend longer than 33 pips either up or down and a peak or troth is not recorded until the price swings in the opposite direction more than 33 pips. once the last peak and the last troth is known, i want to subtract the two from each other to come up with the length of the wave, as well as the distance it took for the wave to form. let me explain a little bit about my data. each row has four numbers, it represents the opening price, the high price, the low price and the closing price of a five minute block. only the high and low price i think is important for this algorithm. here's how i'm thinking the algorithm would work but i'm not familiar enough with vba syntax to write it. starting point = sp active row high = arh active row low = arl if arh - sp 33 then ar = peak or if arl - sp < -33 then ar = troth if arh peak then arh = newpeak if arl - newpeak < -33 then newpeak = ultimatepeak, subtract ultimatepeak from sp, place value in row where ultimatepeak occurred, also subtract number of blocks between ultimatepeak and starting point, place value in column to the right. if arl < troth then arl = newtroth if arh - newroth 33 then newtroth = ultimatetroth, subtract ultimatetroth from ultimatepeak, place value where ultimatetroth occurred, also subtract number of blocks between ultimatetroth and ultimatepeak, place value in column to the right. if arh peak then arh = newpeak if arl - newpeak < -33 then newpeak = ultimatepeak, subtract ultimatepeak from ultimatetroth, place value where ultimatepeak occurred, also subtract number of blocks between ultimatepeak and ultimatetroth, place value in column to the right. i have provided an example which you can see he http://spreadsheets.google.com/pub?k...3A&output=html the first troth occurs at row 57 at the low price of 1.3985. this is because the starting point is 1.4099 and the price never climbs above the required 33 pips which would be 1.4132 in order for a peak to be registered, but the price does climb below the required 1.4067 in order for a troth to be registered. as the price falls below 1.4067 the first time (i think because i was using a different program that could not register highs and lows only closes) the active cell high is greater than the ultimate troth by 33 pips is at row 57 1.3985. from 1.3985 the price then climbs upwards to 1.4210 at row 102, during that time, the price never fell below the ultimate peak by 33 pips (i think, i might be wrong). we then subtract 1.4210 from 1.3985 and put 225 in the h column (that's the length) and subtract 102 from 57 and get 45, that's the time and put that in column i. however we could not know that 1.4210 would be the ultimate peak until the active row low fell below 1.4177, when that happened that's when we do the calculation. as the price falls below 1.4177, each new low becomes the ulitmate low until the active row high subtracted from that ultimate troth is greater than 33 pips. that happened at row 130, price 1.4081. 1.4081 becomes the ultimate troth as soon as the active row high rises above 33 pips which would be 1.4114. as soon as that happens we subtract 1.4210 from 1.4081 and get -129 and put that in column H. we also subtract 130 from 102 and get 28, that's the time and we put that in column i. the price then rises to 1.4175 and once it falls more than 33 pips from that peak below 1.4142 that's where the data ends for this example. let me also explain why this is important. the market moves in waves. certain wave patterns predict different lengths in future waves. by understanding wave patterns one can have a better sense of where the market is going. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Does Microsoft disseminate their market penetration to the market? | Excel Discussion (Misc queries) | |||
Measuring Accuracy | Excel Discussion (Misc queries) | |||
Measuring Average Changes | Excel Discussion (Misc queries) | |||
How to calculate market growth and market share? | Excel Programming | |||
period of sum of sine waves | Excel Programming |