Calculation methods and limitations:
Because it is impossible to keep all possible combinations in memory, the bot calculates the prices as follows:
1) A set of per second averages from the current price(1 sec) to 300 sec. age. Calculated as the classic EMA (Pnext = (Pprev * N + Pcurr) ./ (N + 1)
2) Minute averages from 2 to 90 minutes ago. Calculated simply as the average price per minute
3) Hourly averages from 1 to 41 hours ago (exchange limitations exist) (is calculated as the average price of the 5м candles) Thus, the X,Y parameters in the EMA formula may be: 1..300 or 2m..90m or 1h..41h
4) If Y is 1s the comparison will be made with the current price
5) Recalculation of hourly max/min is performed every 5 minutes, as a new 5m candlesticks appear. To avoid doubling of Max(1h)/Min(1h) and Max(60m)/Min(60m) records, the hourly ones are recalculated from 1 hour ago. For example, max(1h,1) is taken by 5 minute candlesticks from 60 to 120 minutes ago.
6) Recalculation of minute max/min is carried out every tick (1 tick = 2 sec), i.e. with a delay from 2 to 4 sec. At the same time, the last 60 seconds are not included in the calculation of the levels of minute max/min.
Thus, a sharp increase at the last minute (for minute intervals) and during the last 60 minutes (for hourly intervals) is not considered in calculating max/min levels and, therefore, in a moment the max value can be more than zero and min less than zero. It is done in this way to be able to give create a higher-high/lower-low using the formula (i.e. to write a condition that the current price has become higher than the maximum or lower than the minimum over the last N minutes/hours).
What is the methodology used to calculate and limit the EMA intervals?
:
Strategy settings