为了改进这个PostgreSQL查询以计算"Aroon Indicator",可以使用以下步骤:
WITH lag_prices AS (
SELECT
timestamp,
high_price,
low_price,
LAG(high_price) OVER (ORDER BY timestamp) AS lag_high_price,
LAG(low_price) OVER (ORDER BY timestamp) AS lag_low_price
FROM stock_prices
)
SELECT
timestamp,
((timestamp - lag_high_price) / 14) * 100 AS aroon_up,
((timestamp - lag_low_price) / 14) * 100 AS aroon_down
FROM lag_prices;
请注意,以上答案仅为参考,具体情况下需要根据实际需求和环境来进行调整和优化。
领取专属 10元无门槛券
手把手带您无忧上云