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)