gpt-4-0314· openai
Suzhen/CodeChat
i want a code for indicator detect engulfing candles on trading view pines script
- User
i want a code for indicator detect engulfing candles on trading view pines script
- Assistant
Here is a simple code for a TradingView Pine Script that detects bullish and bearish engulfing candles:
//@version=4 study(title="Engulfing Candle Indicator", shorttitle="ECI", overlay=true) // Function for finding engulfing candles is_engulfing_bullish() => close[1] > open[1] and close[0] > close[1] and open[0] < close[1] and open[0] < open[1] and close[0] > open[1] is_engulfing_bearish() => close[1] < open[1] and close[0] < close[1] and open[0] > close[1] and open[0] > open[1] and close[0] < open[1] // Plot engulfing candle shapes plotshape(is_engulfing_bullish(), style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny) plotshape(is_engulfing_bearish(), style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny)This script detects and displays bullish engulfing candles as an upward-pointing green triangle below the candle, and bearish engulfing candles as a downward-pointing red triangle above the candle. You can copy this code and paste it in the "Pine Editor" on the TradingView platform, then click on "Add to Chart" to activate the script.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.