
시장 감정 지표 (Fear and Greed Index) 를 기반으로 한 동적 하락 거래 전략은 시장의 공포와 탐욕의 감정을 포착하여 거래 결정을 내리는 자동화 된 거래 시스템입니다. 이 전략은 극심한 공포에 입문하고 극심한 탐욕에 입문하여 잠재적인 거래 기회를 획득합니다.
이 전략의 핵심은 시장의 기분을 파악하는 데 있어서, 상하이 지수의 역동적인 변화를 감시하는 것이다.
이것은 시장 심리학에 기반한 혁신적인 거래 전략으로, 시장 정서를 정량화하여 거래 기회를 포착한다. 약간의 잠재적인 위험이 있지만, 지속적인 최적화 및 개선으로, 전략은 실제 거래에서 안정적인 성능을 얻을 것으로 기대된다. 거래자는 실장에 사용하기 전에 충분한 피드백과 변수 최적화를 수행하는 것이 좋습니다.
/*backtest
start: 2024-02-22 00:00:00
end: 2025-02-19 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=6
strategy("Fear and Greed Trading Strategy", overlay=false)
// Manually input Fear and Greed Index data (example values for demo)
fear_and_greed = array.from(40, 35, 50, 60, 45, 80, 20, 10) // Replace with your data points
// Get the current bar index within the array bounds
current_index = bar_index % array.size(fear_and_greed)
// Extract data for the current bar
fgi_value = array.get(fear_and_greed, current_index)
// Initialize variables for previous index and value
var float fgi_prev = na
if (current_index > 0)
fgi_prev := array.get(fear_and_greed, current_index - 1)
// Set thresholds
fear_threshold = 25
greed_threshold = 75
// Determine current and previous states
state_prev = na(fgi_prev) ? "neutral" : fgi_prev < fear_threshold ? "fear" : fgi_prev > greed_threshold ? "greed" : "neutral"
state_curr = fgi_value < fear_threshold ? "fear" : fgi_value > greed_threshold ? "greed" : "neutral"
// Buy and sell conditions
buy_condition = state_prev != "greed" and state_curr == "greed"
sell_condition = state_prev != "fear" and state_curr == "fear"
// Execute trades
if (buy_condition)
strategy.entry("Buy", strategy.long, qty=100)
if (sell_condition)
strategy.close("Buy")
// Plotting for visualization
plot(fgi_value, color=color.new(color.white, 0), linewidth=2, title="Fear and Greed Index")
hline(fear_threshold, "Fear Threshold", color=color.red, linestyle=hline.style_dashed)
hline(greed_threshold, "Greed Threshold", color=color.green, linestyle=hline.style_dashed)
// Add labels for actions
if (buy_condition)
label.new(bar_index, fgi_value, "Buy", style=label.style_label_down, color=color.green, textcolor=color.white)
if (sell_condition)
label.new(bar_index, fgi_value, "Sell", style=label.style_label_up, color=color.red, textcolor=color.white)