Vcs
Vcs
0 at
https://mozilla.org/MPL/2.0/
// © Jerryg7
// This base source code is subject to the terms of the Mozilla Public License 2.0
at https://mozilla.org/MPL/2.0/
// © TheMas7er and bmistiaen
//this verion is from version 51 of the 294,54 branch that is adding AMR and time
filtering
//@version=5
indicator('M7 DRCs', overlay=true, max_lines_count=500, max_boxes_count=500,
max_labels_count=500)
//import PineCoders/VisibleChart/4 as PCchart
grptz = "Colorss"
var box[] boxA = array.new_box(0)
inADRColor = input.color(color.rgb(66, 222, 250, 85), title='ADR', inline="2",
group=grptz)
inADRBorderColor = input.color(color.rgb(66, 222, 250, 85), title='border',
inline="2", group=grptz, tooltip = "Box Color | Border Color")
groupX="Extras"
_extendTDRC = 1 *24
lookbackTime = timestamp(year(last_bar_time), month(last_bar_time),
dayofmonth(last_bar_time) -lookbackDays, hour(last_bar_time) , 0)
//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////
//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////
//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////
//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////
//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
/////////////////////////
var float idrrange = na
var int box1barindexstart=na
// } Inputs
// Variables {
var int startTime = na
var int endTime = na
var int leaveRegularSessionTime = na
// } Variables
// Functions {
f_insession(_session) =>
not na(time(timeframe.period, _session, TIMEZONE))
// } Functions
// array.clear(RetraceArray)
else if enterExtend
currentSession := inRegularExtend ? regularExtend : inOvernightExtend ?
overnightExtend : inAfterExtend ? afterExtend : na
if inSession
if not inSession[1]
startTime := time
sessionOpen := open_value
rdrhigh := high_value
rdrlow := low_value
ridrlow := math.min(open_value, close_value)
ridrhigh := math.max(open_value, close_value)
//Initialize DR Confirm states added May 31 JG
// Calculate levels
rdrhigh := math.max(high_value, rdrhigh)
rdrlow := math.min(low_value, rdrlow)
ridrhigh := math.max(open_value, close_value, ridrhigh)
ridrlow := math.min(open_value, close_value, ridrlow)
rdrmiddle := math.avg(rdrhigh, rdrlow)
ridrmiddle := math.avg(ridrhigh, ridrlow)
//added calc levels for retrace boxxes; intent is to draw boxes for
pullback based on idrhigh pluse or minus step size offset
(rdrhigh+offset*idrrange*Ln)
idrrange := (ridrhigh-ridrlow)
if(leavingRegularExtend )
newbox1 = box.new(bar_index, rdrhigh, bar_index + 10, ridrhigh, text =
"helllo", text_size =labelSize, text_color =sessText,text_halign =
text.align_right, xloc=xloc.bar_index, bgcolor=currentColor, border_color =
currentBorderColor ,extend = extend.right )
array.push(l1,newbox1)
array.push(c1, 0)
array.push(cTTT1, 0)
newbox2 = box.new(bar_index, ridrlow, bar_index + 10, rdrlow, text =
"helllo", text_size =labelSize,text_color =sessText, text_halign =
text.align_right, xloc=xloc.bar_index, bgcolor=currentColor, border_color =
currentBorderColor,extend = extend.right )
array.push(l1,newbox2 )
array.push(c1, 0)
array.push(cTTT1, 0)
if array.size(l1) > 0
for i = 0 to array.size(l1)-1
if i <= array.size(l1)-1 and array.size(l1) > 0
myCount := array.get(c1, i)
myBox := array.get(l1, i)
myCountTTT := array.get(cTTT1, i)
b1 = box.get_top(myBox)
b2 = box.get_bottom(myBox)
if b1>b2
boxTop := b1
boxBottom := b2
else
boxTop := b2
boxBottom := b1
if(bodyLow > boxBottom and bodyLow < boxTop and bodyHigh >boxTop) or
(low > boxBottom and low < boxTop and bodyHigh >boxTop) or (bodyHigh < boxTop and
bodyHigh > boxBottom and bodyLow < boxBottom) or (high < boxTop and high >
boxBottom and bodyLow < boxBottom)
//mylabelxx = label.new(time,low,"BT:"+str.tostring(boxTop)+"
BB:"+str.tostring(boxBottom)+"l"+str.tostring(bodyLow)+"
h:"+str.tostring(bodyHigh),xloc.bar_time,yloc.abovebar,color = color.blue, style =
label.style_circle)
myCount :=myCount +1
if(open == boxTop or close == boxTop or open == boxBottom or
close==boxBottom)
myCountTTT := myCountTTT +1
//mylabelxx = label.new(time,low,"BT:"+str.tostring(boxTop)+"
BB:"+str.tostring(boxBottom)+"o"+str.tostring(open)+"
c:"+str.tostring(close),xloc.bar_time,yloc.abovebar,color = color.blue, style =
label.style_circle)
array.set(c1, i, myCount )
array.set(cTTT1, i, myCountTTT )
array.clear(bl1)
if array.size(l1) > 0
for i = 0 to array.size(l1)-1
if i <= array.size(l1)-1 and array.size(l1) > 0
myBox := array.get(l1, i)
myCount := array.get(c1, i)
myCountTTT := array.get(cTTT1, i)
boxstart = box.get_left(myBox)
boxTop :=
box.get_top(myBox) ///////////////////////////////////////////////
////////////
boxBottom :=
box.get_bottom(myBox) /////////////////////////////////////////
//////////////////
bb= boxTop > boxBottom ?
boxBottom :boxTop /////////////////////////////////////////////////////
//
bbIndex := array.indexof(bl1, bb)
bbLastIndex:=na
dateago := " . "
array.sort(bl1,order.ascending)
bbIndex := array.indexof(bl1, bb)
bbLastIndex := array.lastindexof(bl1, bb)
diff = bbLastIndex - bbIndex
buffer := duplicatesCandles * (diff+1)
else
buffer :=0
array.push(bl1, bb)
////////////////////
///////////////////////////////////////
timex := bar_index+statOffset +buffer
//if array.includes(boxLevels, boxHigh)
//array.includes(levels, value)
if showBodyCloseStat
if buffer > 0
box.set_text(myBox, str.tostring(myCountTTT) +" T ["
+str.tostring(myCount)+"]" +dateago)
else
box.set_text(myBox, str.tostring(myCountTTT) +" T ["
+str.tostring(myCount)+"]" +dateago)
else
box.set_text(myBox, str.tostring(myCountTTT) +" T" +dateago)
//array.set(la1, i, myLabel) // this was added
box.set_right(myBox, timex)