miyako.pro

RSI Algo Trader

This is a simple RSI based signal indicator. It is intended for algorithmic trading by bots, currently working one up for http://bitforex.uk.to and http://okcoin.uk.to to use this.

For the best results leave it on 1-Hour time-frame. It also works best on bitcoin and stocks, not so much oil . GBP/USD and AUD/USD it fairs well too.

When RSI touches 70 it gives a Buy signal and when RSI touches 30 it gives a sell signal. The position is then held out until an opposite signal has been given. If the back-testing shows poor results but looks as though the inverse would be good, there is an easy toggle in the settings to flip it. Also in the code is a nifty method to pragmatically keep a variable's value from resetting each candle until later changed.

MSFT Stock:
ลบออกจากสคริปส์โปรด เพิ่มเข้าไปในสคริปส์โปรด
study("RSI Algo", overlay=true)
myPeriod = input(defval=14, type=integer, title="Period")
myThresholdUp = input(defval=70, type=float, title="Upper Threshold")
myThresholdDn = input(defval=30, type=float, title="Lower Threshold")
myAlgoFlipToggle = input(defval=false, type=bool, title="Imverse Algorthim")
myLineToggle = input(defval=true, type=bool, title="Show Lines")
myLabelToggle = input(defval=true, type=bool, title="Show Labels")
myRSI=rsi(close, myPeriod)
buy = myAlgoFlipToggle ? falling(myRSI,1) and cross(myRSI, myThresholdDn) : rising(myRSI, 1) and cross(myRSI,myThresholdUp)
sell = myAlgoFlipToggle ? rising(myRSI, 1) and cross(myRSI,myThresholdUp) : falling(myRSI,1) and cross(myRSI, myThresholdDn)
myPosition = buy==1 ? 0 : sell==1 or myPosition[1]==1 ? 1 : 0
trendColor = buy ? red : sell ? green : na
plot(myLineToggle ? buy and myPosition[1]==1 ? low - 0.004: sell and myPosition[1]==0 ? high + 0.004 : na : na, color=trendColor, style=line, linewidth=4, editable=false)
plotshape(myLabelToggle ? buy and myPosition[1]==1 ? low - 0.005 : na : na, style=shape.labelup, location=location.absolute, text="Buy", transp=0, textcolor = white, color=black, editable=false)
plotshape(myLabelToggle ? sell and myPosition[1]==0 ? high + 0.005 : na : na, style=shape.labeldown, location=location.absolute, text="Sell", transp=0, textcolor = white, color=black, editable=false)

ความคิดเห็น

can you create Alert for BUY and SELL signal. thank you.
+3 ตอบกลับ
NO LE PUEDO DAR NINGUN COMENTARIO, NO LO HE PODIDO PROBAR
+2 ตอบกลับ
In this script it's assumed that we buy at the lowest point of the hourly candle and sell at the highest. Although RSI will only break 30/70 after some price movement, so we may found ourselfves on the half-way down of the candle at the moment of RSI break before selling. For example, look at 12 July - trading bot according to this script will close not at the highest point, but lower on the candle
+2 ตอบกลับ
amazing_ilya amazing_ilya
Sorry, I meant 13 July drop
ตอบกลับ
miyako.pro amazing_ilya
On tradingview it is merely a visual representation for our eyes to see. In terms of a bot, one may code it to trade exactly how they'd wish for it to open and close. Per the example and what I am working on off tradingview it will buy/sell the moment that rsi touches. The code on tradingview plots the lines about 40 forex pips from the highs and lows. Of course since it is open source on here, it may be adapted for exact specifications such as marking the positions at the OHCL values of candles rather than where I have placed them for ease of viewing.


protected override void OnTick()
{
if (rsi.Result.LastValue < 30)
{
Close(TradeType.Sell);
Open(TradeType.Buy);
}
else if (rsi.Result.LastValue > 70)
{
Close(TradeType.Buy);
Open(TradeType.Sell);
}
}
+6 ตอบกลับ
miyako.pro miyako.pro
Ideally it would be nice if pine script could plot at exact moments, however it is limited to OHCL +/- a number. Pine is awfully limited in many areas such as that.
+2 ตอบกลับ
lostland miyako.pro
@miyako.pro, it seems like this

def OnTick():
currentPosition = "sell"
if rsi(14) < 30 && currentPosition == "buy":
currentPosition = "sell"
Close(TradeType.Buy)
Open(TradeType.Sell)
elif rsi(14) > 70 && currentPosition == "sell" :
currentPosition = "buy"
Close(TradeType.Sell)
Open(TradeType.Buy)
+2 ตอบกลับ
Thanks.. I'm going to test this out. How does if fair as a live strategy? Do we get any repainting?
+1 ตอบกลับ
ความเห็นถูกลบแล้ว
aminqs aminqs
anyone know how to make an alert come only when the buy and sells appear?
+1 ตอบกลับ
หน้าแรก ตัวช่วยคัดกรองหุ้น ตัวคัดกรองฟอเร็กซ์ ตัวคัดกรองคริปโต ปฏิทินเศรษฐกิจ มันทำงานได้อย่างไร ข้อมูลสำคัญของชาร์ต ราคา แนะนำเพื่อน กฎของบ้าน ศูนย์ช่วยเหลือ เว็บไซต์ & โบรกเกอร์ โซลูชั่น วิดเจ็ต โซลูชั่นชาร์ต Lightweight Charting Library บล็อก & ข่าว Twitter
ข้อมูลส่วนตัว ตั้งค่าโปรไฟล์ บัญชีและการเรียกเก็บเงิน แนะนำเพื่อน ตั๋วการขอความสนับสนุนของฉัน ศูนย์ช่วยเหลือ ไอเดียที่ถูกตีพิมพ์ ผู้ติดตาม Following ข้อความส่วนตัว แชท ออกจากระบบ