Guest User

Untitled

a guest
Dec 15th, 2022
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. //@version=4
  2.  
  3. study("My script")
  4.  
  5. // Define an array to hold the open values of up candles with large bodies
  6. var openValues = array.new_float(2, 0)
  7.  
  8. // Check if the current candle is an up candle with a body at least 11% larger than its wick
  9. 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
  10.  
  11. // Move the newest value in the array forward one position
  12. array.unshift( openValues, open)
  13. array.pop(openValues)
  14.  
  15. // Check if the current candle is a down candle
  16. if close < open
  17. // The current candle is a down candle
  18.  
  19. // Calculate the body of the candle as the absolute difference between its open and close
  20. body = abs(close - open)
  21.  
  22. // Calculate the wick of the candle as the absolute difference between the high and the open of the candle
  23. // plus the absolute difference between the low and the close of the candle
  24. wick = abs(high - open) + abs(low - close)
  25.  
  26. // Check if the body of the candle is at least 1.25% larger than its wick
  27. if body >= wick * 1.25
  28. // The body of the candle is at least 1.25% larger than its wick
  29.  
  30. // Check if the close of the candle is smaller than the value in openValues[1]
  31. if close < array.get(openValues, array.size(openValues) - 2)
  32. // The close of the candle is smaller than the value in openValues[1]
  33.  
  34. // Create an alert
  35. alert("Price is Reacted with a larger candle body than wick")
  36. // The close of the candle is not smaller than the value in openValues[1]
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment