0

I'm trying to program an indicator that show the resistant area

the resistant area should be box ( triangle )

the main idea that the indicator detect the highest red candles with upper tale more that 50% of the candle length

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TEST

//@version=4
study("--- TEST --- ", overlay=true)

redbar = close < open
greenbar = close > open
low_tale = min(close,open) - low
upper_tale = high - max(open,close)
candle_length = high - low


hiLen = input(title="High Length", type=input.integer, defval=25)
hiHighs = highest(high, hiLen)[1]

loLen = input(title="Low Length", type=input.integer, defval=25)
loLows = lowest(low, loLen)[1]


if redbar and upper_tale > ( 0.5 * candle_length ) and high > hiHighs
    label.new(bar_index, high, "Short", yloc = yloc.abovebar, color = color.red, style = label.style_arrowdown)

the demo image as shown now

it shows red arrows, but I wanna it show a box

this is what I wanna to do

enter image description here

  • I wanna to show the last 4 candles with it's box as shown with the same condition , but i can increase it or decrease it as input

** of course the top of the box is the high of the target candle and the Low of the box is the low of the target candle

Bjorn Mistiaen
  • 6,459
  • 3
  • 18
  • 42
Ahmed Ashkar
  • 33
  • 2
  • 9

1 Answers1

0

Check it - https://www.tradingview.com/script/db9fuGm0-Price-Action-Inside-Bar-Boxes/

This script automatically draws rectangles around bars inside IB pattern, but it can be changed for your task

Lenny
  • 1