From 11948508254e2d4b1fcab88524868edaab8c0203 Mon Sep 17 00:00:00 2001 From: jpwysocz Date: Wed, 12 Feb 2025 15:20:47 -0800 Subject: [PATCH] updates --- README.md | 1 + indicators/Price_Box_v6.pine | 65 ++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 indicators/Price_Box_v6.pine diff --git a/README.md b/README.md index be34826..59dc2e4 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,4 @@ - [ ] Multi-time frame analysis (trend, czy volume wyczytać z innych chart-timeline) - [ ] Tworzenie kanału - [ ] Biblioteka ATM (parametry wyjścia) + diff --git a/indicators/Price_Box_v6.pine b/indicators/Price_Box_v6.pine new file mode 100644 index 0000000..fe18198 --- /dev/null +++ b/indicators/Price_Box_v6.pine @@ -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() \ No newline at end of file