
이 전략은 쌍의 EMA와 RSI 조합 전략으로 불리며, 쌍의 EMA 지표와 RSI 지표의 장점을 결합하여 보다 완전한 거래 의사 결정 기반을 형성한다. 이 전략은 쌍의 EMA를 사용하여 가격 경향과 트렌드 신호를 판단하며, RSI 지표에 보조되어 오버 바이 오버 셀 상황을 판단하고, 낮은 바이 오버 시드를 달성하고, 가격 격차를 얻는다.
이 전략은 우선 두 개의 EMA 지표를 사용하여 가격의 전반적인 추세를 판단합니다. 이 EMA 지표는 가격의 추세를 비교적 잘 반영합니다. 이 두 개의 EMA 지표가 결합되면 가격 상승과 하락의 추세를 판단 할 수 있습니다. 전략에서 단기 EMA 주기를 34로 설정하여 단기 경향과 입장을 판단합니다.
동시에, 전략은 RSI 지표를 도입하여 과매매 상황을 판단한다. RSI는 가격의 하락 변화를 통해 시장이 과매매 또는 과매매 상태에 진입했는지 판단한다. RSI 낮은 가격의 구매, 높은 가격의 판매, EMA 지표와 상호 검증, 가짜 신호를 줄이고 수익 가능성을 높일 수 있다.
이 전략은 쌍의 EMA와 RSI 두 지표의 설계 거래 규칙을 통합하여, 서로 다른 지표에 따라 단기 및 장기 추세를 판단하고, 과매 과매 판단을 보조하여, 간단하고 효율적으로 낮은 가격과 높은 가격을 달성합니다. 단일 지표에 비해이 전략은 신뢰성이 높고 적응력이 강합니다. 그러나 지표의 실패 위험을 예방하고, 적절한 시간에 중지 손실과 위치 관리를해야합니다.
/*backtest
start: 2022-11-22 00:00:00
end: 2023-11-22 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
//chia se cho rieng cong dong t.me/beincypto_vn
strategy('Sonic R & RSI only BTCUSD D1 strategy', //ten chien luoc
shorttitle='sonic R & RSI Strategy', //ten rut gon cua chien luoc
overlay=true,//
close_entries_rule="FIFO", //thu tu dong lenh la bat ky
default_qty_type=strategy.percent_of_equity, //loai so luong mac dinh la ti le phan tram cua von
max_bars_back=500, // so luong thanh toi da la 500
default_qty_value=100, //so luong vao lenh la 100 %
calc_on_order_fills=false, //
pyramiding=1, // kim tu thap, 1 thi moi la thuc
commission_type=strategy.commission.percent, // loai phan tram phi giao dich
commission_value=0.2, //ti le phan tram phi giao dich
process_orders_on_close=true, // tinh toan chien luoc khi dong lenh
calc_on_every_tick=false) // sau khi dong nen moi vao lenh
ema34high = ta.ema(high, 34) // lay ema cao nhat cua 34 thanh nen
h=plot(ema34high, color=color.new(#A5D6A7, 0)) // hien thi ema cao nhat cua 34 thanh
ema34low = ta.ema(low, 34) // lay ema thap nhat cua 34 thanh nen
l=plot(ema34low, color=color.new(#EF9A9A, 0)) // hien thi ema thap nhat cua 34 thanh
fill(h, l, color = color.green, transp=90) // hien thi may giua ema cao va thap
rsi = ta.rsi(close, 14) // rsi 14 thanh
dkienmua1 = close > ema34high and close[2] > ema34high // dieu kien mua 1 khi gia lon hon ema 34 cao nhat va nen truoc do (nen 2) cung lon hon nen ema 34 cao nhat
if dkienmua1 // neu thoa man dieu kien mua 1
strategy.entry('buyEMA', strategy.long) // vao lenh mua trong bieu do hien chu buyEMA
dkienban1 = close < ema34low and close[2] < ema34low // dieu kien ban 1 khi gia nho hon ema34 nho nhat va nen truoc do cung vay
if dkienban1 // nen dieu kien 1 thoa man
strategy.close('buyEMA',comment='CloseEMA') // dong lenh buyema truoc do, hien thi o bieu do la chu closeEMA
dkienmua2 = ta.lowest(rsi, 3) < 29 and rsi > rsi[3] and rsi > 30 // dieu kien mua 2 khi gia thap nhat cua rsi 3 thanh gan day nho hon 29 va rsi lon hon rsi cay thu 3 truoc do
if dkienmua2 // neu dieu kien mua 2 thoa man
strategy.entry('buyRSI', strategy.long) // vao lenh mua dat ten la buyRSI
dkienban2 = ta.highest(rsi, 5) > 70 and rsi < 70 // dieu kien ban 2 khi RSI cao nhat trong 5 cay lon hon 70 va RSI nho hon 70
if dkienban2 // neu dieu kien 2 thoa man
strategy.close('buyRSI',comment='CloseRSI') // dong lenh buySI truoc do, tren bieu do hien thi chu closeRSI