Dear Stata experts,

To better present my question, here is a sample of my data, which consists of 344 firms from 09/2010 to 12/2017:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(openingprice pricehigh closingprice Timestamp) long Firm float FirmID
28.56 28.69 28.37 18535 1 1
28.44  28.5 28.31 18536 1 1
28.31 28.87 28.62 18539 1 1
28.62 28.75 28.62 18540 1 1
28.62 28.87 28.69 18541 1 1
28.56    29 28.56 18542 1 1
28.87    29    29 18543 1 1
   29 29.75 29.69 18546 1 1
29.62 29.94 29.87 18547 1 1
   30    31    31 18548 1 1
30.94    31 29.87 18549 1 1
29.81 30.44 29.81 18550 1 1
30.06 30.62 29.87 18553 1 1
30.31 30.37 30.37 18554 1 1
30.37 30.56 30.31 18555 1 1
30.75 30.75 30.19 18556 1 1
30.19 30.81 30.62 18557 1 1
30.75 31.06 30.69 18560 1 1
   31 31.19    31 18561 1 1
   31 31.25 31.25 18562 1 1
31.25 31.37 30.87 18563 1 1
30.81 30.94 29.69 18564 1 1
29.87 31.06 30.62 18567 1 1
30.87 30.87 30.56 18568 1 1
30.69    31 30.81 18569 1 1
30.81 31.19 30.75 18570 1 1
30.62 30.75  30.5 18571 1 1
30.75 30.75  30.5 18574 1 1
 30.5 31.06    31 18575 1 1
   31    31 30.56 18576 1 1
30.94 30.94 30.56 18577 1 1
30.25 30.37 30.19 18578 1 1
30.19 30.19 30.12 18581 1 1
   30    30 29.44 18582 1 1
29.37    30    30 18583 1 1
30.31 30.69 30.25 18584 1 1
30.37 30.37 29.75 18585 1 1
30.37 30.62 30.19 18588 1 1
30.06 30.06 29.56 18589 1 1
29.44 29.69 29.69 18590 1 1
29.94 30.12 29.75 18591 1 1
29.87    30 29.75 18592 1 1
29.81 30.19 29.44 18595 1 1
29.75 29.87 29.75 18596 1 1
29.87  30.5  30.5 18597 1 1
 30.5    31 30.81 18598 1 1
31.06 31.19 30.81 18599 1 1
30.94 31.25 31.06 18602 1 1
30.94    31 30.75 18603 1 1
30.37 31.19 31.19 18604 1 1
31.12  31.5 31.25 18605 1 1
31.25  32.5 31.62 18606 1 1
   32 32.56 32.31 18609 1 1
32.44  32.5 32.37 18610 1 1
32.37 32.44 32.37 18611 1 1
32.25  32.5 31.75 18612 1 1
   32 32.25 31.75 18613 1 1
31.56 32.44 32.12 18616 1 1
32.25 32.44 32.12 18617 1 1
32.37 32.56 32.37 18618 1 1
32.62 32.62 32.25 18619 1 1
    .     . 32.25 18620 1 1
32.25  32.5 32.44 18623 1 1
 32.5 33.56 32.87 18624 1 1
33.25 33.44 32.69 18625 1 1
32.81 32.87 32.37 18626 1 1
    .     . 32.37 18627 1 1
 32.5  34.5 34.31 18630 1 1
 34.5 35.44 34.94 18631 1 1
35.31  35.5 34.94 18632 1 1
    .     . 34.94 18633 1 1
35.25 35.25 34.69 18634 1 1
   35 35.06  34.5 18637 1 1
34.75    35 34.87 18638 1 1
35.25 35.25 34.94 18639 1 1
35.12 35.12  34.5 18640 1 1
34.56 34.94 34.75 18641 1 1
34.87 34.87  34.5 18644 1 1
 34.5 34.69 34.37 18645 1 1
 34.5  34.5 33.06 18646 1 1
33.25 33.37 31.94 18647 1 1
   32 32.37 31.44 18648 1 1
31.94 31.94 31.37 18651 1 1
31.69 32.06 31.75 18652 1 1
32.19 32.31 31.81 18653 1 1
 31.5 32.37 31.94 18654 1 1
31.87 32.37 31.56 18655 1 1
 31.5  31.5 31.12 18658 1 1
31.31 31.66 31.56 18659 1 1
31.56 31.62 30.56 18660 1 1
30.62 30.81 30.81 18661 1 1
31.06 31.56 30.81 18662 1 1
31.19 32.19 31.81 18665 1 1
32.19 32.37 32.12 18666 1 1
32.37 34.69 34.44 18667 1 1
34.56 35.81 34.87 18668 1 1
35.19 35.19 34.62 18669 1 1
35.81 37.06 36.25 18672 1 1
36.69 36.81 35.87 18673 1 1
35.94 36.06 35.56 18674 1 1
end
format %td Timestamp
label values Firm Firm
label def Firm 1 " BILI A", modify
First, I identify days when opening and high stock prices increase by 15% or greater from yesterday's closing price.

Code:
gen StaticUpper= 0
bysort FirmID ( Timestamp ): replace StaticUpper = 1 if ((openingprice[_n] - closingprice[_n-1]) / closingprice[_n-1]) >= 0.15   
bysort FirmID (Timestamp): replace StaticUpper = 1 if ((pricehigh[_n] - closingprice[_n-1]) / closingprice[_n-1]) >= 0.15
and we obtain 36,593 observations:

Code:
sum StaticUpper if StaticUpper ==1
Code:
Variable             Obs    Mean    Std.Dev.    Min    Max
                        
StaticUpper         36,593    1          0      1       1
What I would like to do now is to see how these 36,593 observations behave the next day, in time _n+1. In other words, I would like to create a dummy variable that takes the value of 1 for the next day when StaticUpper ==1 only and zero in all other times including StaticUpper ==1 at time _n. All my attempts to code this variable fail and I would greatly appreciate any help.

Thank you