Before calculating SAR, a period should be selected, such as n days or n weeks, and the parameters of n days or n weeks are generally 4 days or 4 weeks.
Taking the SAR value of Tn period as an example, the calculation formula is as follows:
SAR(Tn)= SAR(Tn- 1)+AF(Tn)*[EP(Tn- 1)-SAR(Tn- 1)]
When calculating the SAR value, the following principles should be noted:
Determination of 1. Initial value SAR(T0)
If SAR (T 1) rises during T 1, then SAR(T0) is the lowest price during T0.
If T 1 has a downward trend, SAR(T0) is the highest price in T0;
2. Determination of extreme price EP
If Tn cycle is on the rise, EP(Tn- 1) is the highest price of Tn- 1 cycle.
If Tn cycle is in a downward trend, EP(Tn- 1) is the lowest price of Tn- 1 cycle;
3. Determination of acceleration factor AF
(a) The initial value of acceleration factor is 0.02, that is, af (t0) = 0.02;
(b) If Tn- 1 and Tn period are both rising,
When the period maximum price of Tn >: Tn- 1 period maximum price, AF(Tn)=AF(Tn- 1)+0.02.
When the highest price of Tn cycle
(c) If Tn- 1 and Tn period are in a downward trend,
When the lowest price of Tn cycle
When the lowest price of Tn period is >: =Tn- 1, then AF (TN) = AF (TN-1);
(d) Every time the market changes, the acceleration factor AF must be recalculated from 0.02;
For example, Tn- 1 period is an upward trend, Tn period is a downward trend (or Tn- 1 falls and Tn rises), and AF(Tn) needs to be recalculated based on 0.02, that is, AF (TN) = AF (t0) = 0.02;
(e) The acceleration factor af shall not exceed 0.2 at most. When af >: 0.2, AF shall be recalculated from 0.02;
Determination of 4.4. specific absorption ratio
(a) Calculate the value of Tn period by the formula SAR (TN) = SAR (TN-1)+AF (TN) * [EP (TN-1)-SAR (TN-1)];
(2) If the Tn cycle is on the rise,
When SAR (TN) >: lowest price in TN period (or SAR (TN) >; The lowest price of Tn- 1 period), and the final SAR value of Tn period should be the minimum value of Tn- 1 period and the lowest price of Tn period.
When sar (TN)
(c) If the Tn cycle is in a downward trend,
When sar (TN)
When SAR (TN) >: = the highest price in TN period and SAR (TN) >; = Tn- 1 period highest price, then the final SAR value of Tn period is SAR(Tn), that is, SAR = SAR (TN);
T- that day;
N- length of time;
Ci-[ closing price on the first day].
Hi-the highest price on the I day;
Li-the first day [lowest price].
TRi = max(Hi,Ci- 1)-min(Li,Ci- 1)
Note: generally n= 14, m=6.
In fact, it is a process of summation and average.
The calculation formula is as follows:
Deviation rate = [(closing price of the day-average price of N days)/average price of N days ]* 100%
Where n is 6,12,24.
Deviation is a relatively simple indicator.
Taking daily CCI calculation as an example, there are two calculation methods.
The first calculation process is as follows:
CCI(N days) = (TP-MA) ÷ MD ÷ 0.0 15
Where TP= (highest price+lowest price+closing price) ÷3
MA= cumulative sum of closing prices in recent n days ÷N
MD= cumulative sum of the last n days (MA- closing price) ÷N
0.0 15 is the calculation coefficient, and n is the calculation period.
There is also a calculation method on the Internet, which is based on the average absolute deviation. If the first one is directly realized, there will be no second one. This concept can only recognize a few words, which is daunting.
Just a hint, please use absolute value when calculating MD, otherwise the calculated indicator line will be wrong.