RicardoSantos

[RS]MicuRobert System V0

Request for MicuRobert.
開源腳本

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?
//@version=2
//  Request for MicuRobert
study(title='[RS]MicuRobert System V0', shorttitle='MAC', overlay=true)
src = input(title='Source series:', type=source, defval=close)
ma0_length = input(title='Moving average length', type=integer, defval=1)
ma1_length = input(title='Moving average length', type=integer, defval=50)
sl_in_pips = input(title='Stoploss in pips:', type=float, defval=4.00, step=0.01) * (syminfo.mintick*10)

ma0 = sma(src, ma0_length)
ma1 = sma(src, ma1_length)
plot(title='MA0', series=ma0, color=gray)
plot(title='MA1', series=ma1, color=black)

crossup = crossover(ma0, ma1)
crossdown = crossunder(ma0, ma1)
direction_up = barssince(crossup) <= barssince(crossdown)
plotshape(title='UP', series=crossup, style=shape.triangleup, location=location.abovebar, color=green)
plotshape(title='DOWN', series=crossdown, style=shape.triangledown, location=location.belowbar, color=maroon)

buy_sl = direction_up ? na(buy_sl[1]) ? low-sl_in_pips : max(low-sl_in_pips, buy_sl[1]) : na
sel_sl = not direction_up ? na(sel_sl[1]) ? high+sl_in_pips : min(high+sl_in_pips, sel_sl[1]) : na
plot(title='BSL', series=buy_sl, style=circles, color=black)
plot(title='SSL', series=sel_sl, style=circles, color=black)

buy_close = direction_up and crossunder(ma0, buy_sl)
sel_close = not direction_up and crossover(ma0, sel_sl)
plotshape(title='BX', series=buy_close, style=shape.xcross, location=location.belowbar, color=green)
plotshape(title='SX', series=sel_close, style=shape.xcross, location=location.abovebar, color=maroon)

open_range = input(title='Open range value:', type=float, defval=0.0020, step=0.00001)
isnewday = change(time('D'))!=0
open_price = isnewday ? open : open_price[1]
open_top = open_price + open_range
open_bot = open_price - open_range
plot(title='O', series=open_price, color=isnewday ? na : black)
plot(title='OT', series=open_top, color=isnewday ? na : blue)
plot(title='OB', series=open_bot, color=isnewday ? na : blue)