Chiến lược mua&bán phụ thuộc vào AO+Stoch+RSI+ATR

Tác giả:ChaoZhang, Ngày: 2022-05-20 15:52:46
Tags:RSIATRSTOCHSMA

Chiến lược này chỉ dành cho việc đào tạo, mục đích của nó chỉ là học mã bằng chữ chữ thông. Đừng đưa ra quyết định mua hoặc bán với chiến lược này.

Thổ Nhĩ Kỳ / Thổ Nhĩ Kỳ Chiến lược này chỉ có thể mã hóa kịch bản bằng cách làm gì đó để giúp chúng tôi. Bu stratejiye dayanarak, kesinlikle al-sat islemleri yapmayin.

Làm thế nào nó hoạt động?

Khi RSI và Stoch ở trong khu vực bán quá mức và nếu osc tuyệt vời biến thành tích cực, mua vị trí dài.

Khi RSI và Stoch đang mua quá mức và nếu osc. trở nên âm, mua vị trí ngắn.

Thổ Nhĩ Kỳ / Thổ Nhĩ Kỳ

RSI và Stoch asiri satım bölgesinde iken awesome positive döner is long position açar, zarar kes ve kar al seviyeleri ATR chỉ số ile tanımlandı.

RSI và thị trường chứng khoán trong khu vực của chúng tôi đã trở nên tiêu cực đáng kinh ngạc trong một vị trí ngắn, và các chỉ số ATR của chúng tôi đã được xác định.

backtest img


/*backtest
start: 2022-04-19 00:00:00
end: 2022-05-18 23:59:00
period: 30m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4

strategy("Buy&Sell Strategy depends on AO+Stoch+RSI+ATR by SerdarYILMAZ", shorttitle="Buy&Sell Strategy")
// Created by Serdar YILMAZ
// This strategy is just for training, its purpose is just learning code in pine script.
// Don't make buy or sell decision with this strategy.
// Bu strateji sadece pine script'te kodlamanın nasıl yapildigini ogrenmek icindir.
// Bu stratejiye dayanarak, kesinlikle al-sat islemleri yapmayin.

//AO

fast=input(title="Fast Length",type=input.integer,defval=3)
slow=input(title="Slow length",type=input.integer,defval=17)

awesome=(sma(hl2,fast)-sma(hl2,slow))*1000

plot(awesome, style=plot.style_histogram, color=(awesome>awesome[1]?color.green:color.red))

//Stoch

K=input(title="K",type=input.integer,defval=14)
D=input(title="D",type=input.integer,defval=3)
smooth=input(title="smooth",type=input.integer,defval=3)

k=sma(stoch(close,high,low,K),D)
d=sma(k,smooth)

hline(80)
hline(20)

plot(k,color=color.blue)

//RSI

rsisource=input(title="rsi source",type=input.source,defval=low)
rsilength=input(title="rsi length",type=input.integer,defval=10)

rsi=rsi(rsisource,rsilength)

hline(70,color=color.orange)
hline(30,color=color.orange)

plot(rsi,color=color.orange)

//ATR

atrlen=input(title="ATR Length", type=input.integer,defval=14)

atrvalue=rma(tr,atrlen)

plot(atrvalue*1000,color=color.green)

LongCondition=k<20 and rsi<30 and awesome>awesome[1]
ShortCondition=k>80 and rsi>70 and awesome<awesome[1]
if (LongCondition)
    stoploss=low-atrvalue
    takeprofit=close+atrvalue
    strategy.entry("Long Position", strategy.long)
    strategy.exit("TP/SL",stop=stoploss,limit=takeprofit)
    
if (ShortCondition)
    stoploss=high+atrvalue
    takeprofit=close-atrvalue
    strategy.entry("Short Position",strategy.short)
    strategy.exit("TP/SL",stop=stoploss,limit=takeprofit)
    
    

    
    




Có liên quan

Thêm nữa