Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © ZenAndTheArtOfTrading
- //@version=4
- study("Swanidhi", overlay=true)
- // Define condition (Bullish Engulfing Candle)
- condition() => close > open[1] and close[1] < open[1]
- // Find first condition bar & price
- var firstTimeFlag = false
- var firstTimeConditionBar = -1
- var firstTimeClose = -1.0
- conditionBool = condition()
- for i = 0 to bar_index
- if conditionBool and not firstTimeFlag
- firstTimeConditionBar := bar_index
- firstTimeClose := close[i]
- firstTimeFlag := true
- // Plot data
- plot(firstTimeClose != -1.0 ? firstTimeClose : na, color=color.red, offset=-30)
- plot(firstTimeConditionBar, color=color.blue, transp=100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement