Move indicators folder to misc directory
This commit is contained in:
57
misc/indicators/Chandelier_Exit_v6.pine
Normal file
57
misc/indicators/Chandelier_Exit_v6.pine
Normal file
@@ -0,0 +1,57 @@
|
||||
//@version=6
|
||||
// Copyright (c) 2019-present, Alex Orekhov (everget)
|
||||
// Chandelier Exit script may be freely distributed under the terms of the GPL-3.0 license.
|
||||
indicator('Chandelier Exit', shorttitle = 'CE', overlay = true)
|
||||
|
||||
var string calcGroup = 'Calculation'
|
||||
length = input.int(title = 'ATR Period', defval = 22, group = calcGroup)
|
||||
mult = input.float(title = 'ATR Multiplier', step = 0.1, defval = 3.0, group = calcGroup)
|
||||
useClose = input.bool(title = 'Use Close Price for Extremums', defval = true, group = calcGroup)
|
||||
|
||||
var string visualGroup = 'Visuals'
|
||||
showLabels = input.bool(title = 'Show Buy/Sell Labels', defval = true, group = visualGroup)
|
||||
highlightState = input.bool(title = 'Highlight State', defval = true, group = visualGroup)
|
||||
|
||||
var string alertGroup = 'Alerts'
|
||||
awaitBarConfirmation = input.bool(title = 'Await Bar Confirmation', defval = true, group = alertGroup)
|
||||
|
||||
atr = mult * ta.atr(length)
|
||||
|
||||
longStop = (useClose ? ta.highest(close, length) : ta.highest(length)) - atr
|
||||
longStopPrev = nz(longStop[1], longStop)
|
||||
longStop := close[1] > longStopPrev ? math.max(longStop, longStopPrev) : longStop
|
||||
|
||||
shortStop = (useClose ? ta.lowest(close, length) : ta.lowest(length)) + atr
|
||||
shortStopPrev = nz(shortStop[1], shortStop)
|
||||
shortStop := close[1] < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop
|
||||
|
||||
var int dir = 1
|
||||
dir := close > shortStopPrev ? 1 : close < longStopPrev ? -1 : dir
|
||||
|
||||
var color longColor = color.green
|
||||
var color shortColor = color.red
|
||||
var color longFillColor = color.new(color.green, 90)
|
||||
var color shortFillColor = color.new(color.red, 90)
|
||||
var color textColor = color.new(color.white, 0)
|
||||
|
||||
longStopPlot = plot(dir == 1 ? longStop : na, title = 'Long Stop', style = plot.style_linebr, linewidth = 2, color = color.new(longColor, 0))
|
||||
buySignal = dir == 1 and dir[1] == -1
|
||||
plotshape(buySignal ? longStop : na, title = 'Long Stop Start', location = location.absolute, style = shape.circle, size = size.tiny, color = color.new(longColor, 0))
|
||||
plotshape(buySignal and showLabels ? longStop : na, title = 'Buy Label', text = 'Buy', location = location.absolute, style = shape.labelup, size = size.tiny, color = color.new(longColor, 0), textcolor = textColor)
|
||||
|
||||
shortStopPlot = plot(dir == 1 ? na : shortStop, title = 'Short Stop', style = plot.style_linebr, linewidth = 2, color = color.new(shortColor, 0))
|
||||
sellSignal = dir == -1 and dir[1] == 1
|
||||
plotshape(sellSignal ? shortStop : na, title = 'Short Stop Start', location = location.absolute, style = shape.circle, size = size.tiny, color = color.new(shortColor, 0))
|
||||
plotshape(sellSignal and showLabels ? shortStop : na, title = 'Sell Label', text = 'Sell', location = location.absolute, style = shape.labeldown, size = size.tiny, color = color.new(shortColor, 0), textcolor = textColor)
|
||||
|
||||
midPricePlot = plot(ohlc4, title = '', style = plot.style_circles, linewidth = math.max(1, 0), display = display.none, editable = false)
|
||||
|
||||
longStateFillColor = highlightState ? dir == 1 ? longFillColor : na : na
|
||||
shortStateFillColor = highlightState ? dir == -1 ? shortFillColor : na : na
|
||||
fill(midPricePlot, longStopPlot, title = 'Long State Filling', color = longStateFillColor)
|
||||
fill(midPricePlot, shortStopPlot, title = 'Short State Filling', color = shortStateFillColor)
|
||||
|
||||
await = awaitBarConfirmation ? barstate.isconfirmed : true
|
||||
alertcondition(dir != dir[1] and await, title = 'Alert: CE Direction Change', message = 'Chandelier Exit has changed direction!')
|
||||
alertcondition(buySignal and await, title = 'Alert: CE Buy', message = 'Chandelier Exit Buy!')
|
||||
alertcondition(sellSignal and await, title = 'Alert: CE Sell', message = 'Chandelier Exit Sell!')
|
||||
65
misc/indicators/Price_Box_v6.pine
Normal file
65
misc/indicators/Price_Box_v6.pine
Normal file
@@ -0,0 +1,65 @@
|
||||
//@version=6
|
||||
indicator("Order Levels Visualization", overlay=true)
|
||||
|
||||
// Create a new box for each new candle
|
||||
//box := box.new(bar_index, high, bar_index + 10, low, color.gray, 1, line.style_dashed, extend.none, xloc.bar_index)
|
||||
|
||||
|
||||
// Input parameters for order levels
|
||||
buyLimitPrice = input.price(title="Buy Limit Price", defval=0.0)
|
||||
sellLimitPrice = input.price(title="Sell Limit Price", defval=0.0)
|
||||
|
||||
// Input parameters for rectangle width and shading
|
||||
rectangleWidth = input.int(title="Rectangle Width (Price Units)", defval=10, minval=1)
|
||||
showDebugInfo = input.bool(title="Show Debug Information", defval=false)
|
||||
buyShadeColor = input.color(title="Buy Limit Shade Color", defval=color.new(color.green, 90))
|
||||
sellShadeColor = input.color(title="Sell Limit Shade Color", defval=color.new(color.red, 90))
|
||||
borderColor = input.color(title="Border Color", defval=color.gray)
|
||||
|
||||
// Function to draw rectangles and shaded areas
|
||||
drawOrderLevels() =>
|
||||
// Clear any existing boxes
|
||||
var boxes = array.new_box()
|
||||
|
||||
// Buy limit rectangle
|
||||
if buyLimitPrice > 0
|
||||
buyRectTop = buyLimitPrice + rectangleWidth / 2
|
||||
buyRectBottom = buyLimitPrice - rectangleWidth / 2
|
||||
|
||||
box buyBox = box.new(left=bar_index, top=buyRectTop, right=bar_index + 500,
|
||||
bottom=buyRectBottom, border_color=borderColor,
|
||||
border_width=1, bgcolor=buyShadeColor)
|
||||
|
||||
// Debug information
|
||||
if showDebugInfo
|
||||
label buyLabel = label.new(x=bar_index, y=buyLimitPrice,
|
||||
text='Buy Limit\n' +
|
||||
'Price: ' + str.tostring(buyLimitPrice, format.mintick) + '\n' +
|
||||
'Top: ' + str.tostring(buyRectTop, format.mintick) + '\n' +
|
||||
'Bottom: ' + str.tostring(buyRectBottom, format.mintick),
|
||||
color=color.blue, style=label.style_note)
|
||||
|
||||
array.push(boxes, buyBox)
|
||||
|
||||
// Sell limit rectangle
|
||||
if sellLimitPrice > 0
|
||||
sellRectTop = sellLimitPrice + rectangleWidth / 2
|
||||
sellRectBottom = sellLimitPrice - rectangleWidth / 2
|
||||
|
||||
box sellBox = box.new(left=bar_index, top=sellRectTop, right=bar_index + 500,
|
||||
bottom=sellRectBottom, border_color=borderColor,
|
||||
border_width=1, bgcolor=sellShadeColor)
|
||||
|
||||
// Debug information
|
||||
if showDebugInfo
|
||||
label sellLabel = label.new(x=bar_index, y=sellLimitPrice,
|
||||
text='Sell Limit\n' +
|
||||
'Price: ' + str.tostring(sellLimitPrice, format.mintick) + '\n' +
|
||||
'Top: ' + str.tostring(sellRectTop, format.mintick) + '\n' +
|
||||
'Bottom: ' + str.tostring(sellRectBottom, format.mintick),
|
||||
color=color.red, style=label.style_note)
|
||||
|
||||
array.push(boxes, sellBox)
|
||||
|
||||
// Plot the order levels
|
||||
drawOrderLevels()
|
||||
Reference in New Issue
Block a user