Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- study("My script")
- // Define an array to hold the open values of up candles with large bodies
- var openValues = array.new_float(2, 0)
- // Check if the current candle is an up candle with a body at least 11% larger than its wick
- if close > open and abs(close - open) >= (abs(high - close) + abs(low - open)) * 1.10 // The current candle is an up candle with a body at least 11% larger than its wick
- // Move the newest value in the array forward one position
- array.unshift( openValues, open)
- array.pop(openValues)
- // Check if the current candle is a down candle
- if close < open
- // The current candle is a down candle
- // Calculate the body of the candle as the absolute difference between its open and close
- body = abs(close - open)
- // Calculate the wick of the candle as the absolute difference between the high and the open of the candle
- // plus the absolute difference between the low and the close of the candle
- wick = abs(high - open) + abs(low - close)
- // Check if the body of the candle is at least 1.25% larger than its wick
- if body >= wick * 1.25
- // The body of the candle is at least 1.25% larger than its wick
- // Check if the close of the candle is smaller than the value in openValues[1]
- if close < array.get(openValues, array.size(openValues) - 2)
- // The close of the candle is smaller than the value in openValues[1]
- // Create an alert
- alert("Price is Reacted with a larger candle body than wick")
- // The close of the candle is not smaller than the value in openValues[1]
Advertisement
Add Comment
Please, Sign In to add comment