Excel forms for Stocks- How to Track Dow Jones (DJIA) Patterns Like Up, Down, Up Up, Down Down

rebel123

Active Member
Joined
Apr 18, 2017
Messages
347
Office Version
  1. 365
Platform
  1. MacOS
I uploaded the file here- https://file.io/Vr7mDPckVRSI

PART 1


In the beginning, I need at least the formula to figure out UP down.... But then I need an idea of probability also.

PART 2

I will consider (or you can consider) editing any columns or adding or deleting columns.

The whole idea of what I am trying to figure out here is probability. And get answers.
This is the Dow Jones stock market results every day for the last 5 years.
So, I am not even sure if my extra columns are correct.

I want to answer questions, such as follows:
1. If the Dow Jones goes up 1 day what are the odds it goes down the next day? (this assumes that the previous day it went down. Otherwise the pattern went up to or more days)\
So for example, if the pattern was
Up Down Up Down Up Down Up Down Up Down Up Down
Then the answer should pretty much be 100% because it's going up and down everyday. I understand the first one in bold might not be an answer, since it's the first set in the pattern.

So for example, if the pattern was

Up Up Down Up Down Down Down Up
The number of occurrences would be

Up Down- Happened Once
Down Up- Happened Once

So I have no idea to calculate real probability on this king of pattern either.


2. If the Dow Jones goes down 1 day what are the odds it goes up the next day? (this assumes that the previous day it went up. Otherwise the pattern went down to or more days)

I attached an image
 

Attachments

  • Screen Shot 2021-01-30 at 10.35.51 AM-min.jpg
    Screen Shot 2021-01-30 at 10.35.51 AM-min.jpg
    250.3 KB · Views: 25

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Not exhaustively tested, but I think this works:

ABCDE
1
2UpN (No of Ups)1
3DownFreq (Down at N+1)1
4DownFreq (Up >=N)2
5DownPr. Down after 1 Ups50%
6Down
7Down
8Up
9Down
10Down
11Down
12Down
13Up
14Up
15Down
16Down
17Down
18Down
19Down
20Down
21Down
22Up
Sheet3
Cell Formulas
RangeFormula
E3E3=SUM(--(N=FREQUENCY(IF(INDEX(Moves,MATCH("Down",Moves,)):INDEX(Moves,MATCH(2,1/(Moves="Down")))="Up",ROW(INDEX(Moves,MATCH("Down",Moves,)):INDEX(Moves,MATCH(2,1/(Moves="Down"))))),IF(INDEX(Moves,MATCH("Down",Moves,)):INDEX(Moves,MATCH(2,1/(Moves="Down")))="Down",ROW(INDEX(Moves,MATCH("Down",Moves,)):INDEX(Moves,MATCH(2,1/(Moves="Down"))))))))
E4E4=E3+SUM(--(N+1<=FREQUENCY(IF(INDEX(Moves,MATCH("Down",Moves,)):INDEX(Moves,ROWS(Moves))="Up",ROW(INDEX(Moves,MATCH("Down",Moves,)):INDEX(Moves,ROWS(Moves)))),IF(INDEX(Moves,MATCH("Down",Moves,)):INDEX(Moves,ROWS(Moves))="Down",ROW(INDEX(Moves,MATCH("Down",Moves,)):INDEX(Moves,ROWS(Moves)))))))
D5D5="Pr. Down after "&N&" Ups"
E5E5=IFERROR(E3/E4,"-")
Named Ranges
NameRefers ToCells
Moves=Sheet3!$B$2:$B$22E3:E4
N=Sheet3!$E$2D5, E3:E4


UpN (No of Ups)2
UpFreq (Down at N+1)1
UpFreq (Up >=N)2
DownPr. Down after 2 Ups50%
Down
Down
Up
Down
Down
Down
Down
Up
Up
Down
Down
Down
Up
Up
Up
Down
Up


UpN (No of Ups)4
DownFreq (Down at N+1)2
UpFreq (Up >=N)3
UpPr. Down after 4 Ups67%
Up
Up
Up
Down
Up
Up
Up
Up
Down
Up
Down
Down
Up
Up
Up
Up
Down
 
Upvote 0
OK thanks man let me test it now.... I may need help even inputting this... lol
 
Upvote 0
Here is what I redid...
 

Attachments

  • Screen Shot 2021-01-31 at 2.33.01 PM-min.jpg
    Screen Shot 2021-01-31 at 2.33.01 PM-min.jpg
    174.5 KB · Views: 10
Upvote 0
So, I re-uploaded the file here https://file.io/14USg7SayERy

As mentioned, you were probably correct and it's 100% my fault. I figured out how to do the down ups.
So, I would just need 4 formulas that would start in cells J2 K2 L2 and M2.
 
Upvote 0
I didn't look at your attachment before, but now neither of your links appears to be working.

Attached is an expanded version of my workbook, set up to accommodate Down or Up runs of variable length N: Frequency Up Down.xlsx

I have also conditionally formatted to illustrate/check the counts.

BCDEFG
1MoveHelperInput
2UpFALSEDirection of runDown
3DownFALSEN (No of Downs required)2
4UpFALSE
5DownFALSECalculationsCheck
6UpFALSEReverse directionUp
7UpFALSEFreq (Up at 3)3232
8DownFALSEFreq (Down at 2+)6565
9UpFALSEProb (Up after 2 Downs)49%
10DownFALSE
11DownFALSE
12DownTRUE
13DownFALSE
14DownFALSE
15DownFALSE
16DownFALSE
17UpFALSE
18DownFALSE
19DownFALSE
20UpTRUE
21DownFALSE
22DownFALSE
23DownTRUE
24UpFALSE
25UpFALSE
26UpFALSE
27DownFALSE
28UpFALSE
29DownFALSE
30UpFALSE
31DownFALSE
32DownFALSE
33DownTRUE
34DownFALSE
35UpFALSE
36UpFALSE
37DownFALSE
38DownFALSE
39DownTRUE
40UpFALSE
41DownFALSE
42DownFALSE
43UpTRUE
44DownFALSE
Sheet3
Cell Formulas
RangeFormula
E3E3="N (No of " & Direction & "s required)"
F6F6=IF(Direction="Up","Down","Up")
E7E7="Freq (" & Reverse & " at " &N+1 &")"
F7F7=SUM(--(N=FREQUENCY(IF(INDEX(Moves,MATCH(Reverse,Moves,)):INDEX(Moves,MATCH(2,1/(Moves=Reverse)))=Direction,ROW(INDEX(Moves,MATCH(Reverse,Moves,)):INDEX(Moves,MATCH(2,1/(Moves=Reverse))))),IF(INDEX(Moves,MATCH(Reverse,Moves,)):INDEX(Moves,MATCH(2,1/(Moves=Reverse)))=Reverse,ROW(INDEX(Moves,MATCH(Reverse,Moves,)):INDEX(Moves,MATCH(2,1/(Moves=Reverse))))))))
G7G7=COUNTIFS(Helper,TRUE,Moves,Reverse)
E8E8="Freq (" & Direction & " at " & N &"+)"
F8F8=F7+SUM(--(N+1<=FREQUENCY(IF(INDEX(Moves,MATCH(Reverse,Moves,)):INDEX(Moves,ROWS(Moves))=Direction,ROW(INDEX(Moves,MATCH(Reverse,Moves,)):INDEX(Moves,ROWS(Moves)))),IF(INDEX(Moves,MATCH(Reverse,Moves,)):INDEX(Moves,ROWS(Moves))=Reverse,ROW(INDEX(Moves,MATCH(Reverse,Moves,)):INDEX(Moves,ROWS(Moves)))))))
G8G8=COUNTIF(Helper,TRUE)
E9E9="Prob (" & Reverse &" after "&N& " "& Direction & "s)"
F9F9=IFERROR(F7/F8,"-")
C2:C44C2=IFERROR(AND(OFFSET(B2,-N-1,)=Reverse,AND(OFFSET(B2,-1,,-N)=Direction)),FALSE)
Named Ranges
NameRefers ToCells
Direction=Sheet3!$F$2C2:C44, E3, F6:F8, E8:E9
Helper=Sheet3!$C$2:$C$501G7:G8
Moves=Sheet3!$B$2:$B$501C2, G7, F7:F8
N=Sheet3!$F$3C2:C44, E7:E9, F7:F8
Reverse=Sheet3!$F$6C2:C44, G7, E9, E7, F7:F8
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B501Expression=AND(C2,B2=Reverse)textNO
B2:B501Expression=AND(C2,B2=Direction)textNO
B2:B501Expression=AND(B2=Direction,ISNUMBER(MATCH(TRUE,OFFSET(C2,1,,N),)))textNO
Cells with Data Validation
CellAllowCriteria
F2ListUp,Down
 
Upvote 0
So far we've considered only two possibilities, Up or Down.

We can adjust to accommodate Same, i.e. no movement. But it depends on how you want to treat these.

For example, is Down|Up|Up|Same|Up|Up
- A run of five ups?
- Two runs of two Ups?
- Neither?
 
Upvote 0
Upvote 0
IF the link isnt working i separated it...


https :// safeno te.co/open?reference=60194a5ebe0333@55242225
 
Upvote 0
Here's a simple illustration, using the workbook I attached to Post #6, and with a smaller data sample. If I'm interpreting you correctly, your probabilities of Up Up, and Up Down are two sides of the same coin, as illustrated with the green/red colouring?

MoveHelperInput
UpFALSEDirection of runUp
DownFALSEN (No of Ups required)1
UpFALSE
DownTRUECalculationsCheck
UpFALSEReverse directionDown
UpTRUEFreq (Down at 2)66
DownFALSEFreq (Up at 1+)99
UpFALSEProb (Down after 1 Ups)67%
DownTRUE
DownFALSEYour probabilities
DownFALSEUp Up33%
DownFALSEUp Down67%
DownFALSE
DownFALSE
DownFALSE
UpFALSE
DownTRUE
DownFALSE
UpFALSE
DownTRUE
DownFALSE
DownFALSE
UpFALSE
UpTRUE
UpFALSE
DownFALSE
UpFALSE
DownTRUE
UpFALSE
DownTRUE
DownFALSE
DownFALSE
DownFALSE
UpFALSE
UpTRUE
DownFALSE

If that's correct, then using your workbook, the probabilities look like this (I have also extrapolated to show runs of 2. You can extend further if you wish):

My workbook: DJIA movements up down.xlsx

ABCDEFGHIJKLMNO
1DateOpenHighLowCloseAdj CloseVolumeUp Or DownDaily MovementInput
22016-02-0116,45416,51116,29916,44916,4491144500-4.45DownDirection of runUpDownUpDown
32016-02-0216,42016,42016,10816,15416,1541262100-266.67DownMinimum length of run required (N)1122
42016-02-0316,18616,38215,96016,33716,3371418700150.46UpCalculations
52016-02-0416,33016,48616,26616,41716,417131490086.91UpReverse directionDownUpDownUp
62016-02-0516,41816,42416,13016,20516,2051390100-212.98DownFreq (run reverses at N+1)1561757281
72016-02-0816,14816,14815,80416,02716,0271658800-120.46DownFreq (run of length N or more))316315160140
82016-02-0916,00516,13715,88116,01416,01412774008.97UpProb (reverse after run of N)49%56%45%58%
92016-02-1016,03616,20215,90015,91515,9151222900-120.87Down
102016-02-1115,89815,89815,50315,66015,6601720700-237.64DownYour probabilitiesUpUpDownDownUpUpUpDownDownDown
112016-02-1215,69215,97415,69215,97415,9741325500282.22Up50.6%44.4%55.0%42.1%
122016-02-1616,01216,19616,01216,19616,1961420300184.02UpUpDownDownUpUpUpDownDownDownUp
132016-02-1716,21816,48616,21816,45416,4541240800235.85Up49.4%55.6%45.0%57.9%
142016-02-1816,48416,51216,39016,41316,4131049500-70.33Down
DJIA 5 History
Cell Formulas
RangeFormula
L5:O5L5=IF(L2="Up","Down","Up")
L6:O6L6=SUM(--(L3=FREQUENCY(IF(INDEX(Moves,MATCH(L5,Moves,)):INDEX(Moves,MATCH(2,1/(Moves=L5)))=L2,ROW(INDEX(Moves,MATCH(L5,Moves,)):INDEX(Moves,MATCH(2,1/(Moves=L5))))),IF(INDEX(Moves,MATCH(L5,Moves,)):INDEX(Moves,MATCH(2,1/(Moves=L5)))=L5,ROW(INDEX(Moves,MATCH(L5,Moves,)):INDEX(Moves,MATCH(2,1/(Moves=L5))))))))
L7:O7L7=L6+SUM(--(L3+1<=FREQUENCY(IF(INDEX(Moves,MATCH(L5,Moves,)):INDEX(Moves,ROWS(Moves))=L2,ROW(INDEX(Moves,MATCH(L5,Moves,)):INDEX(Moves,ROWS(Moves)))),IF(INDEX(Moves,MATCH(L5,Moves,)):INDEX(Moves,ROWS(Moves))=L5,ROW(INDEX(Moves,MATCH(L5,Moves,)):INDEX(Moves,ROWS(Moves)))))))
L8:O8L8=IFERROR(L6/L7,"-")
L10:O10L10=REPT(L2,L3+1)
L11:O11L11=1-L8
L12:O12L12=REPT(L2,L3)&L5
L13:O13L13=L8
H2:H14H2=E2-B2
Named Ranges
NameRefers ToCells
Moves='DJIA 5 History'!$I$2:$I$1260L6:O7
Cells with Data Validation
CellAllowCriteria
L2:O2ListUp,Down
 
Upvote 0
Solution

Forum statistics

Threads
1,215,606
Messages
6,125,805
Members
449,262
Latest member
hideto94

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top