Wednesday, February 4, 2009

Code Spreadsheet for data analysis

To calculate candlestick true range
= CandlestickHigh - CandlestickLow

To calculate candlestick body range
= abs(CandlestickOpen - CandlestickClose)
*abs is absolute number, return no negative

To calculate Upper Shadow Candlestick range
=if( CandlestickClose>CandlestickOpen;CandlestickHigh-CandlestickClose;CandlestickHigh-CandlestickOpen)

To calculate Lower Shadow Candlestick
=if( CandlestickClose>CandlestickOpen;CandlestickOpen-CandlestickLow;CandlestickClose-CandlestickLow)


How to calculate how many long and how many short candlestick
Step 1: assign Long = 1, and Short = 0

=if(CandlestickClose>CandlestickOpen;1;0)

*code show if Close>Open then assign the candlestick to 1 or else 0
this also mean...
Long = 1
Short = 0

Step 2:
Sum all the assign number
= sum(FirstCandlestick:Lastcandlestick)
= this will return how many candlestick in direction Long

Subtract to find Short
= Count(FirstCandlestick:LastCandlestick) - sum(FirstCandlestick:Lastcandlestick)
= this will return how many candlestick in direction Short

Step 3:
let say we want to convert to %
= (long candlestick / total candlestick) * 100%
and
= (short candlestick / total candlestick) * 100%

No comments:

Post a Comment