OPEN-SOURCE SCRIPT

IntraDay ROCKET v2

31
//{ HEADING
//version=5
indicator(title='IntraDay ROCKET v2'
, shorttitle='IntraDay ROCKET v2'
, overlay=true
, max_bars_back=1000
, max_labels_count=500
, max_lines_count=500)
//}

//{ INPUTS
BarColorControl=input(title
='IntraDay Rocket Bar Colors ?',defval=true)

BGColorControl=input(title
='IntraDay Rocket Background Colors ?',defval=false)

TrailingControl=input(title
='IntraDay Rocket Guided StopLoss Lines ?',defval=true)

//}

//{ COLORS
RayBGGreen = color.rgb(69, 250, 0, 90)
RayBGRed = color.rgb(255, 58, 58, 90)
RayGreen = color.rgb(69, 250, 0)
RayRed = color.rgb(255, 58, 58)
RayOrange = color.rgb(176, 69, 0, 0)
RayBlue = color.rgb(5, 77, 231, 37)
RayBlack = color.rgb(0, 0, 0, 0)
RayWhite = color.rgb(255, 255, 255, 75)
RayWhite2 = color.rgb(255, 255, 255, 0)
RayFuscia = color.rgb(217, 23, 198, 50)
RayBG = color.rgb(150, 150, 150, 90)
BlankColor = color.rgb(150, 150, 150, 100)
//}

//{ PARAMS
Periods = 30
SRC = hl2
Multiplier = 2.0
ChangeATR = true
atr2 = ta.sma(ta.tr, Periods)
atr = ChangeATR ? ta.atr(Periods) : atr2
up = SRC - Multiplier * atr
up1 = nz(up[1], up)
up := close[1] > up1 ? math.max(up, up1) : up
dn = SRC + Multiplier * atr
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? math.min(dn, dn1) : dn
trend = 1
trend := nz(trend[1], trend)
//}

//{ STRATEGY
trend := trend == -1 and close > dn1 ? 1
: trend == 1 and close < up1 ? -1 : trend

buySignal = trend == 1 and trend[1] == -1

upPlot = plot(trend == 1
? up : na, title='Intra Day Rocket Up Trend'
, style=plot.style_linebr
, linewidth=2
, color= TrailingControl ? RayGreen : BlankColor)

dnPlot = plot(trend == 1
? na : dn, title='Intra Day Rocket Down Trend'
, style=plot.style_linebr
, linewidth=2
, color= TrailingControl ? RayRed : BlankColor)

sellSignal = trend == -1 and trend[1] == 1

colorthing=
BarColorControl and trend == 1 ? RayGreen
: BarColorControl and trend == -1 ? RayRed : na

plotcandle(open, high, low, close
, "Intra Day Rocket Candle Color"
, colorthing, wickcolor=colorthing)

bgcolor(
BGColorControl and trend == 1 ? RayBGGreen
: BGColorControl and trend == -1 ? RayBGRed
: BlankColor
, title="Intra Day Rocket Background Color")
//}

//{ TABLE
TableColors=
trend == 1 ? RayGreen : RayRed

var RayTable =
table.new(
position.top_right
, columns = 1
, rows = 1
, frame_width = 2
, border_width = 1)
////////////////////////
yyy =
trend == 1
? "LONG POSITION ONLY !"
: trend == -1
? "SHORT POSITION ONLY !" : na

////////////////////////
table.cell(
table_id = RayTable
, column = 0
, row = 0
, text = yyy
, text_color = RayBlack
, bgcolor = TableColors)
//}

//{ ALERTS
alertcondition(buySignal
, title='Enter Long Position'
, message='Enter Long Position!')

alertcondition(sellSignal
, title='Enter Short Position'
, message='Enter Short Position!')

changeCond = trend != trend[1]

alertcondition(changeCond
, title='Direction Change'
, message='Changed Direction!')
//}

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน