Dashboard and Signals Table
Dashboard and Signals Table
0
at https://mozilla.org/MPL/2.0/
// © bcracker82
//@version=6
plot(close)
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0
at https://mozilla.org/MPL/2.0/
// © bcracker82
//@version=6
plot(close)
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0
at https://mozilla.org/MPL/2.0/
// © bcracker82
//@version=6
plot(close)
//@version=6
// User Inputs
// Indicators
fastMA_val = ta.ema(close, fastMA)
atr_val = ta.atr(atrLength)
// Entry Conditions
// Define explicit colors for each column with green and black
// Create Table for displaying TP, SL, and Strength levels (Vertical Table)
if (longCondition)
if (shortCondition)
// Visual Signals
// Plot MAs
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0
at https://mozilla.org/MPL/2.0/
// © fluxchart
//@version=5
OBsEnabled = true
timeframe1Enabled = true
timeframe1 = ""
atr = ta.atr(10)
type orderBlockInfo
float top
float bottom
float obVolume
string obType
int startTime
float bbVolume
float obLowVolume
float obHighVolume
bool breaker
int breakTime
string timeframeStr
string combinedTimeframesStr = na
type orderBlock
orderBlockInfo info
box orderBox = na
box breakerBox = na
line orderBoxLineTop = na
line orderBoxLineBottom = na
line breakerBoxLineTop = na
line breakerBoxLineBottom = na
//
box orderBoxText = na
box orderBoxPositive = na
box orderBoxNegative = na
line orderSeperator = na
line orderTextSeperator = na
newOrderBlock
orderBlockF.isRendered := false
box.delete(orderBlockF.orderBox)
box.delete(orderBlockF.breakerBox)
box.delete(orderBlockF.orderBoxText)
box.delete(orderBlockF.orderBoxPositive)
box.delete(orderBlockF.orderBoxNegative)
line.delete(orderBlockF.orderBoxLineTop)
line.delete(orderBlockF.orderBoxLineBottom)
line.delete(orderBlockF.breakerBoxLineTop)
line.delete(orderBlockF.breakerBoxLineBottom)
line.delete(orderBlockF.orderSeperator)
line.delete(orderBlockF.orderTextSeperator)
type timeframeInfo
int index = na
string timeframeStr = na
orderBlockInfo[] bullishOrderBlocksList = na
orderBlockInfo[] bearishOrderBlocksList = na
newTFInfo = timeframeInfo.new()
newTFInfo.index := index
newTFInfo.isEnabled := isEnabled
newTFInfo.timeframeStr := timeframeStr
newTFInfo
type obSwing
int x = na
float y = na
float swingVolume = na
if isTimeframeLower(timeframe1F, timeframe2F)
timeframe1F
else
timeframe2F
if isTimeframeLower(timeframe1F, timeframe2F)
timeframe2F
else
timeframe1F
else
seconds = timeframe.in_seconds(timeframeF)
else
string ret = na
ret := "Bull"
ret := "Bear"
ret
ob.isRendered := true
if ob.info.combined
ob.orderBox.set_bgcolor(colorWithTransparency(orderColor, 1.1))
if orderBlockVolumetricInfo
ob.orderBoxPositive := createOBBox(bullOrderBlockColor)
ob.orderBoxNegative := createOBBox(bearOrderBlockColor)
ob.orderSeperator :=
line.new(na,na,na,na,xloc.bar_time,extend.none,textColor,line.style_dashed,1)
ob.orderTextSeperator :=
line.new(na,na,na,na,xloc.bar_time,extend.none,textColor,line.style_solid,1)
if na(info.breakTime)
OBText = (na(ob.info.combinedTimeframesStr) ?
formatTimeframeString(ob.info.timeframeStr) : ob.info.combinedTimeframesStr) + "
OB"
box.set_text(ob.orderBoxText, (orderBlockVolumetricInfo ?
str.tostring(ob.info.obVolume, format.volume) + " (" + str.tostring(percentage) +
"%)\n" : "") + (combinedText and ob.info.combined ? "[Combined]\n" : "") + OBText)
if orderBlockVolumetricInfo
showHighLowBoxText = false
box.set_text(ob.orderBoxPositive, showHighLowBoxText ?
str.tostring(info.obHighVolume, format.volume) : "")
box.set_text(ob.orderBoxNegative, showHighLowBoxText ?
str.tostring(info.obLowVolume, format.volume) : "")
findOBSwings(len) =>
var swingType = 0
upper = ta.highest(len)
lower = ta.lowest(len)
[top, bottom]
findOrderBlocks () =>
useBody = false
bullishBreaked = 0
if bullishOrderBlocksList.size() > 0
for i = bullishOrderBlocksList.size() - 1 to 0
currentOB = bullishOrderBlocksList.get(i)
if not currentOB.breaker
currentOB.breaker := true
currentOB.breakTime := time
currentOB.bbVolume := volume
else
bullishOrderBlocksList.remove(i)
bullishBreaked := 1
top.crossed := true
boxBtm = max[1]
boxTop = min[1]
boxLoc = time[1]
newOrderBlockInfo.obLowVolume := volume[2]
bullishOrderBlocksList.unshift(newOrderBlockInfo)
bullishOrderBlocksList.pop()
// Bearish Order Block
bearishBreaked = 0
if bearishOrderBlocksList.size() > 0
for i = bearishOrderBlocksList.size() - 1 to 0
currentOB = bearishOrderBlocksList.get(i)
if not currentOB.breaker
currentOB.breaker := true
currentOB.breakTime := time
currentOB.bbVolume := volume
else
bearishOrderBlocksList.remove(i)
bearishBreaked := 1
btm.crossed := true
boxBtm = min[1]
boxTop = max[1]
boxLoc = time[1]
newOrderBlockInfo.obHighVolume := volume[2]
bearishOrderBlocksList.unshift(newOrderBlockInfo)
bearishOrderBlocksList.pop()
true
float edge1 = math.sqrt((XA2 - XA1) * (XA2 - XA1) + (YA2 - YA2) * (YA2 - YA2))
float edge2 = math.sqrt((XA2 - XA2) * (XA2 - XA2) + (YA2 - YA1) * (YA2 - YA1))
totalArea
true
else
false
valid = true
if OBInfo.disabled
valid := false
valid
combineOBsFunc () =>
if allOrderBlocksList.size() > 0
lastCombinations = 999
lastCombinations := 0
for i = 0 to allOrderBlocksList.size() - 1
curOB1 = allOrderBlocksList.get(i)
for j = 0 to allOrderBlocksList.size() - 1
curOB2 = allOrderBlocksList.get(j)
if i == j
continue
continue
if curOB1.info.obType != curOB2.info.obType
continue
if doOBsTouch(curOB1.info, curOB2.info)
curOB1.info.disabled := true
curOB2.info.disabled := true
orderBlock newOB =
createOrderBlock(orderBlockInfo.new(math.max(curOB1.info.top, curOB2.info.top),
math.min(curOB1.info.bottom, curOB2.info.bottom), curOB1.info.obVolume +
curOB2.info.obVolume, curOB1.info.obType))
newOB.info.startTime := math.min(curOB1.info.startTime,
curOB2.info.startTime)
newOB.info.breakTime := math.max(nz(curOB1.info.breakTime),
nz(curOB2.info.breakTime))
newOB.info.breakTime := newOB.info.breakTime == 0 ? na :
newOB.info.breakTime
newOB.info.timeframeStr := curOB1.info.timeframeStr
newOB.info.obVolume := curOB1.info.obVolume +
curOB2.info.obVolume
newOB.info.obLowVolume := curOB1.info.obLowVolume +
curOB2.info.obLowVolume
newOB.info.obHighVolume := curOB1.info.obHighVolume +
curOB2.info.obHighVolume
newOB.info.bbVolume := nz(curOB1.info.bbVolume, 0) +
nz(curOB2.info.bbVolume, 0)
newOB.info.breaker := curOB1.info.breaker or
curOB2.info.breaker
newOB.info.combined := true
if timeframe.in_seconds(curOB1.info.timeframeStr) !=
timeframe.in_seconds(curOB2.info.timeframeStr)
newOB.info.combinedTimeframesStr :=
(na(curOB1.info.combinedTimeframesStr) ?
formatTimeframeString(curOB1.info.timeframeStr) :
curOB1.info.combinedTimeframesStr) + " & " + (na(curOB2.info.combinedTimeframesStr)
? formatTimeframeString(curOB2.info.timeframeStr) :
curOB2.info.combinedTimeframesStr)
allOrderBlocksList.unshift(newOB)
lastCombinations += 1
[bullishOrderBlocksListF, bearishOrderBlocksListF] =
request.security(syminfo.tickerid, timeframeStr, [bullishOrderBlocksList,
bearishOrderBlocksList])
[bullishOrderBlocksListF, bearishOrderBlocksListF]
[bullishOrderBlocksListF, bearishOrderBlocksListF]
else
[na, na]
timeframeInfoF.bullishOrderBlocksList := bullishOrderBlocksListF
timeframeInfoF.bearishOrderBlocksList := bearishOrderBlocksListF
handleOrderBlocksFinal () =>
if DEBUG
if allOrderBlocksList.size () > 0
for i = 0 to allOrderBlocksList.size() - 1
safeDeleteOrderBlock(allOrderBlocksList.get(i))
allOrderBlocksList.clear()
for i = 0 to timeframeInfos.size() - 1
curTimeframe = timeframeInfos.get(i)
if not curTimeframe.isEnabled
continue
if curTimeframe.bullishOrderBlocksList.size() > 0
for j = 0 to math.min(curTimeframe.bullishOrderBlocksList.size() - 1,
bullishOrderBlocks - 1)
orderBlockInfoF = curTimeframe.bullishOrderBlocksList.get(j)
orderBlockInfoF.timeframeStr := curTimeframe.timeframeStr
allOrderBlocksList.unshift(createOrderBlock(orderBlockInfo.copy(orderBlockInfoF)))
if curTimeframe.bearishOrderBlocksList.size() > 0
for j = 0 to math.min(curTimeframe.bearishOrderBlocksList.size() - 1,
bearishOrderBlocks - 1)
orderBlockInfoF = curTimeframe.bearishOrderBlocksList.get(j)
orderBlockInfoF.timeframeStr := curTimeframe.timeframeStr
allOrderBlocksList.unshift(createOrderBlock(orderBlockInfo.copy(orderBlockInfoF)))
if combineOBs
combineOBsFunc()
if allOrderBlocksList.size() > 0
for i = 0 to allOrderBlocksList.size() - 1
curOB = allOrderBlocksList.get(i)
if isOBValid(curOB.info)
renderOrderBlock(curOB)
findOrderBlocks()
[bullishOrderBlocksListTimeframe1, bearishOrderBlocksListTimeframe1] =
getTFData(timeframeInfos.get(0), timeframe1)
if barstate.isconfirmed
handleTimeframeInfo(timeframeInfos.get(0), bullishOrderBlocksListTimeframe1,
bearishOrderBlocksListTimeframe1)
handleOrderBlocksFinal()