PromptBase
Close icon
General
Home
Marketplace
Hire
Create
Login
Sell
Explore
🤖 GPT

Pine Script Multitimeframe Indicator

Pine Script Multitimeframe Indicator gpt prompt mini thumbnail
GPT-4O
TestedTick icon
TipsTick icon
4 examplesTick icon
Pine Script Multi-Timeframe Indicator Creator
...more
$4.99
Get prompt
After purchasing, you will gain access to the prompt file which you can use with GPT or the app builder. You'll receive 20 free generation credits with this purchase. By purchasing this prompt, you agree to our terms of service.
3 days ago

Prompt Details

Model
Chat - GPT-4o (gpt-4o)
Token size
164 ($0.00820 / call)
Example input
[ describe the indicator and its purpose ]: combine RSI from the daily timeframe and MACD from the hourly timeframe to confirm trend reversals
Example output
Here’s a comprehensive Pine Script designed to combine the **RSI** from the daily timeframe and the **MACD** from the hourly timeframe to confirm trend reversals. The script includes all requested features: multi-timeframe capabilities, configurable parameters, overlay options, and color-coded signals. ### Pine Script Code: ```pinescript //@version=5 indicator("Multi-Timeframe RSI & MACD Trend Reversal", overlay=false, shorttitle="MTF_RSI_MACD") // === Input Settings === // RSI Inputs rsiLength = input.int(14, title="RSI Length") rsiOverbought = input.int(70, title="RSI Overbought Level") rsiOversold = input.int(30, title="RSI Oversold Level") rsiTF = input.timeframe("D", title="RSI Timeframe") // MACD Inputs macdFast = input.int(12, title="MACD Fast Length") macdSlow = input.int(26, title="MACD Slow Length") macdSignal = input.int(9, title="MACD Signal Length") macdTF = input.timeframe("60", title="MACD Timeframe (in minutes)") // Visualization Inputs showOnChart = input.bool(false, title="Show Signals on Main Chart (Overlay)") highlightReversals = input.bool(true, title="Highlight Reversal Signals") rsiColor = input.color(color.blue, title="RSI Color") macdColor = input.color(color.orange, title="MACD Color") reversalColorBull = input.color(color.green, title="Reversal Bullish") reversalColorBear = input.color(color.red, title="Reversal Bearish") // === Fetch Multi-Timeframe Data === // RSI from selected timeframe rsiValue = request.security(syminfo.tickerid, rsiTF, ta.rsi(close, rsiLength)) // MACD from selected timeframe [macdLine, signalLine, _] = request.security(syminfo.tickerid, macdTF, ta.macd(close, macdFast, macdSlow, macdSignal)) // === Trend Reversal Logic === // RSI Trend Conditions rsiBullish = rsiValue < rsiOversold rsiBearish = rsiValue > rsiOverbought // MACD Crossover Conditions macdBullish = ta.crossover(macdLine, signalLine) macdBearish = ta.crossunder(macdLine, signalLine) // Combined Signals bullishReversal = rsiBullish and macdBullish bearishReversal = rsiBearish and macdBearish // === Visualization === // Plot RSI in a separate pane rsiPlot = plot(rsiValue, color=rsiColor, title="RSI") hline(rsiOverbought, "Overbought", color=color.new(color.red, 80)) hline(rsiOversold, "Oversold", color=color.new(color.green, 80)) // Plot MACD in a separate pane macdLinePlot = plot(macdLine, color=macdColor, title="MACD Line") signalLinePlot = plot(signalLine, color=color.new(macdColor, 50), title="Signal Line") fill(macdLinePlot, signalLinePlot, color=macdLine > signalLine ? color.new(color.green, 80) : color.new(color.red, 80)) // Overlay signals on the price chart if enabled if showOnChart label.new(bar_index, high, "Bullish Reversal", color=color.new(reversalColorBull, 80), style=label.style_circle, size=size.small) if bullishReversal label.new(bar_index, low, "Bearish Reversal", color=color.new(reversalColorBear, 80), style=label.style_circle, size=size.small) if bearishReversal // Highlight background for reversals if enabled bgcolor(bullishReversal ? color.new(reversalColorBull, 90) : na, title="Bullish Reversal Highlight", editable=highlightReversals) bgcolor(bearishReversal ? color.new(reversalColorBear, 90) : na, title="Bearish Reversal Highlight", editable=highlightReversals) // === Comments for Clarity === // 1. This script pulls RSI and MACD from different timeframes using `request.security`. // 2. Configurable inputs let you tailor the indicator to your trading strategy. // 3. Combined RSI and MACD logic provides potential trend reversal signals. // 4. Overlay and highlight options improve visualization on the chart. ``` ### Features: 1. **Multi-Timeframe Analysis**: - Pulls RSI and MACD data from user-specified timeframes using `request.security`. 2. **Configurable Parameters**: - Adjust RSI length, MACD settings, and timeframes for flexibility. 3. **Visualization**: - Shows RSI and MACD in a separate pane. - Optionally overlays signals on the price chart. - Highlights reversal signals with color-coded backgrounds. 4. **Multi-Indicator Logic**: - Combines RSI and MACD signals to confirm trend reversals. - Easy to extend with additional indicators. 5. **Clear Code Comments**: - Explains how multi-timeframe logic and visual elements work. Let me know if you need further customization or explanation of any part of the script!
Browse Marketplace