Advertisement
theartoftrading

Swanidhi

Jan 28th, 2021
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © ZenAndTheArtOfTrading
  3.  
  4. //@version=4
  5. study("Swanidhi", overlay=true)
  6.  
  7. // Define condition (Bullish Engulfing Candle)
  8. condition() => close > open[1] and close[1] < open[1]
  9.  
  10. // Find first condition bar & price
  11. var firstTimeFlag = false
  12. var firstTimeConditionBar = -1
  13. var firstTimeClose = -1.0
  14. conditionBool = condition()
  15. for i = 0 to bar_index
  16. if conditionBool and not firstTimeFlag
  17. firstTimeConditionBar := bar_index
  18. firstTimeClose := close[i]
  19. firstTimeFlag := true
  20.  
  21. // Plot data
  22. plot(firstTimeClose != -1.0 ? firstTimeClose : na, color=color.red, offset=-30)
  23. plot(firstTimeConditionBar, color=color.blue, transp=100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement