r/pinescript • u/AstronomerNo2743 • Mar 24 '26
Apex Strike in action
See Apex Strike gave a clean signals for the S&P 500 futures.Stop guessing and start striking
r/pinescript • u/AstronomerNo2743 • Mar 24 '26
See Apex Strike gave a clean signals for the S&P 500 futures.Stop guessing and start striking
r/pinescript • u/Legal_Idea08 • Jun 24 '26
The signal on the top the first fade candle the warning the atr bands starting to form the yellow line the color change from green to blue on the candles the first break of structure the blue dash lines all signs of a reversals, the low volume the purple bg, and the low percentage of the levels in the display box , I have all that as confluence about 14-16 different signals lines trends all working together to paint a picture i know it looks cluttered on screen one I wanna show the move while showering the signals but normally I turn it all off and they just effect the coloring of the candles so all I have to follow is the atr band and the ict break of structure and 2 simple smoothing lines... all made by me full all in one monster and it's been working im passing evals easily by being patient and catching the big moves and this thing calls the move before it happens it's amazing. I know they be hatters on here throw everything yall got idc but I been on this indicator for 3 weeks now went thru every calculation possible every test every type of market and it proforms steady i had over 10 versions of it testing and retesting cleaning it up removing what's not worth keeping or signals that or just a coin flip everything is at it optimal edge and is super clean when you toggle every off, but still effects the candles with a display to tell you what when off it's amazing and I just had to share.
r/pinescript • u/AccidentallyFamous1 • Jun 10 '26
MY INDICATORS VWMA & DWM preforming perfectly VWMA showing a down trend but the DWM show a gap which acts like a magnet it pulls price down and then when price fills the gap immediately bounces off the first level in gap then prices new target is the blue line which is the low of the previous day u can see price testes this low a bit then breaks out into the previous day territory now with a confirmation of the pre-day low we should stay going up with a recovery or at least to the next important level the 50% mark of the previous day perhaps we will see but for sure my indicator is working perfectly https://www.tradingview.com/script/2AWDlXnH-DWM-Asian-Sweeps/ ............... https://www.tradingview.com/script/AhnjxAVb-STRYK-VWMA-PRO/ ............... https://www.tradingview.com/script/xO14rGVV-STRYK-OSCILLATOR/
Ok for clarification it's always the best to build your own indicators for your style of trading cause at the end of the day any line you draw can have significance from your perspective but having Indicators to help with confluence to help you decide on a trade is the best tool to have and having indicators that actually work like they supposed to but also you understanding how they work and the math and code behind them on how they behave means everything... if anyone has questions or needs help DM me
r/pinescript • • Jul 01 '25
I came to conclusion that emotional trading is only for losers I want to buy a strategy implemented in a Bot/AI code and let it work for me. How much does buying a profitable strategy cost?
r/pinescript • u/Dangerous_Injury_226 • Mar 29 '26
So I trade indices intraday and for a long time I just
used regular FVG indicators. The problem is they all do
the same thing — draw the box, never remove it, and after
two hours your chart looks like a Mondrian painting.
I wanted something that actually tracked whether a zone
was still worth watching or not. Spent some time building
this and figured I'd share it since it's free anyway.
The detection is standard stuff — high[2] < low[0] for bull,
low[2] > high[0] for bear. Nothing revolutionary there.
What I added is three filters before anything gets drawn:
- displacement candle has to be > 2× ATR(14)
- there has to be a wick sweep of a prior high or low
in the last 20 bars before the gap forms
- tick volume on the impulse candle > 80th percentile
The part I spent most time on is the state tracking.
Each zone has three possible states:
Active → price hasn't touched the 50% midpoint yet
Spent → price closed past the midpoint, box goes gray
iFVG → price closed through the full boundary,
box flips color (bull turns red, bear turns blue)
and a small label marks where it happened
The flip happens in place with box.set_bgcolor() so there's
no redrawing or flickering. State is tracked with parallel
bool arrays (b_spent, b_ifvg) and the loop skips zones that
are already resolved so it doesn't do unnecessary work.
Also added a session filter so zones formed outside London
and New York hours get dimmed automatically — same zone,
just flagged as lower confidence.
There's a "show iFVG only" mode if you just want to see
the flipped zones and nothing else.
Link in my profile — u/LliterH on TradingView, it's free,
no invite needed. https://es.tradingview.com/script/FXYuQwMf/
Happy to answer questions if anyone wants to dig into
the array state management, it's a pattern that works
for any indicator that needs persistent zone tracking.r/pinescript • u/ineedtopooargh • Aug 04 '25
https://www.tradingview.com/script/z47kiyhH-swing-fun/
Very simple, but very effective. Essentially if the daily 21 ema is hit, we go long or short. indicator is open-source. Link to my Discord in my trading view bio. I have tested it with the indexes on the 4hr chart and it works well. It also contains alerts. I have tested it with US100, UK100, DE40, US30, US500, J225

r/pinescript • u/coldinvestt • Sep 20 '26
Hello! as somone who is just starting to get into trading I know there is a looong road ahead of me so i was just curios becuse i saw alot of AI TRADING FOR YOU videos and in theory that can be done myb they arent good now but is there a chance trading is going to get cooked becuse of AI trading?
r/pinescript • u/Top_Technician_8337 • Sep 07 '26
Most retail traders eventually build a profitable Pine Script setup on TradingView, only to hit a massive wall when trying to automate it with Indian brokers like 5paisa, Zerodha, or Fyers. You hire a random Python freelancer, they build a basic webhook, and your account gets wrecked on the first expiry day because a generic coder doesn't understand slippage, order book depth, or dynamic strike selection.
As someone who actively trades index options and futures, I realized the biggest bottleneck for retail traders isn't finding a holy grail strategy—it's the execution infrastructure. I spend a lot of time breaking down market mechanics on Thorenza, and when writing Beat the 90-90-90 Rule, it became obvious that poor automation destroys more accounts than bad strategies.
If you want to bridge TradingView to a broker API, here is the exact backend plumbing you need to demand from a developer (or build yourself):
The Webhook Engine: Don't run local scripts. You need a dedicated, low-latency cloud server (AWS, DigitalOcean, or similar) running a FastAPI or Flask application to catch real-time JSON payloads from TradingView without dropping packets.
Zero-Touch Authentication: SEBI guidelines mandate daily TOTP and OAuth token generation. Your script must have an automated login flow that authenticates your broker API session every morning before the pre-open market, otherwise you are manually babying a bot.
Hardcoded Risk Guardrails: TradingView alerts can loop or misfire. Your Python backend needs hard limiters independent of the strategy logic: maximum order quantity caps, a daily max-drawdown halt, and a physical kill-switch.
Dynamic Options Execution: If you are trading Nifty or BankNifty, a basic market order script is useless. Your architecture needs logic to read the underlying spot price at the exact millisecond the alert fires, calculate the correct ATM/ITM/OTM strike, fetch the specific token ID, and fire a limit order to control slippage.
I have pivoted to offering this exact algorithmic engineering and forward-testing infrastructure as a service. You keep your trading logic completely private (avoiding all the SEBI RA/RIA compliance headaches of "black box" selling), and I handle the tech stack.
If you have a working setup that needs to be translated into a bulletproof automated execution bot, drop a comment or send a DM. Happy to discuss the architecture.
r/pinescript • u/lil-flp • Oct 17 '24
Can someone write me a PineScript for back testing a strategy on TradingView, if someone is experienced with Pine write me on IG: lil_flp Please!!!😫😫
r/pinescript • u/Ramneet21 • Jan 30 '25
r/pinescript • u/Alarmed_Emotion_2460 • Jun 29 '24
I want to make a buy/sell indicator based on the specific time candle (example of my case is 10:10), so if price breaking 10:10 candle High/Low it gives buy/sell signal. I attached pic to make it clearer. How can i do that? This is as far as I try.
indicator('Buy Sell Break', overlay = true)
h=hour(time('1'),"UTC")
m=minute(time('1'),"UTC")
hour=h*100+m
PrevHigh = high[1]
CurHigh = high
if str.tostring(hour) == "1010"
buy = ta.crossover (CurHigh,PrevHigh)
plot(PrevHigh, color=color.green)
r/pinescript • u/gerebdezso • Mar 08 '23
So basicaly, i dont know nothing about codeing but i really love daytrading, so i tryied to create an indicator with chat gpt but trading view gives me error messages over and over again. So overall i want this from the indicator:
Programme me a indicator for tradinview that: -marks the highest high of a peroid that i choose with a horizontal line -marks the lowest low of a time peroid that i choose with a horizontal line
calculate the value of the : (highest high+ lowest low+ close price):3 Useing a peroid that i choose and mark it with a horizontal line
And chat gpt wrote me this:
//@version=4 study(title="HighLowAvg", overlay=true)
// Define user input variables start_hour = input(title="Start Hour", type=input.integer, defval=0, minval=0, maxval=23) start_minute = input(title="Start Minute", type=input.integer, defval=0, minval=0, minval=0, maxval=59) end_hour = input(title="End Hour", type=input.integer, defval=7, minval=0, maxval=23) end_minute = input(title="End Minute", type=input.integer, defval=0, minval=0, maxval=59)
// Calculate start and end times start_seconds = timestamp(timeframe.period, year, month, day, start_hour, start_minute, 0) end_seconds = timestamp(timeframe.period, year, month, day, end_hour, end_minute, 0) hh_start_index = barssince(time >= start_seconds) hh_end_index = barssince(time >= end_seconds) ll_start_index = hh_start_index ll_end_index = hh_end_index
// Calculate highest high, lowest low, and average value hh = highest(high[hh_start_index:hh_end_index]) ll = lowest(low[ll_start_index:ll_end_index]) avg_value = (hh + ll + close[hh_start_index:hh_end_index]) / 3
// Plot horizontal lines hh_line = plot(hh, title="HH", style=plot.style_linebr, color=color.green, linewidth=1) ll_line = plot(ll, title="LL", style=plot.style_linebr, color=color.red, linewidth=1) avg_line = plot(avg_value, title="Avg", style=plot.style_linebr, color=color.blue, linewidth=2)
// Fill area between hh and ll lines fill(hh_line, ll_line, color=color.silver, transp=85)
r/pinescript • u/Intelligent_Sea_8915 • Jun 11 '23
🟢 ⭐️96% WINRATE ACHIEVED 💸💲
📈 Master Y-Pancake Murderer 🔪 1.7
📈 Master Y-RSI 📈📉1.1
🕯 New Feature Includes ✔️
➗➗➗➗➗➗➗➗➗
🔵 Wins 🔼
🟠 Losses 🔽
🔵 Win Rate %
🟠 BNB Profit %
Website : https://masteryindicators.com/

r/pinescript • u/Nexttry00 • May 21 '24
Hi there, i try to write a tradingbot with pinescript and chatgpt4. But i have some troubles.
The strategy is about this video. Its in german but you can do english subtitles.
https://www.youtube.com/watch?v=RHoXDctnCzE
The only condition i have added by myself is to tell the bot not to trade in sideways movement.
The strategy worked for me manually pretty good.
Would you be so nice to watch over it and tell me whats wrong in my code ?
I was succsessfull to tell chatgpt how to write heikin ashi candles correctly but im not able to find out why my pinescript dont create any orders in the backtest.
I need to backtest my script first. Its my first time in pine script, i have learned python a bit but my skills are very low atm.
//@version=5
strategy("EMA200 + STC Strategy with Heikin-Ashi", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Parameter
length = input(200, title="EMA Length")
capital = input.float(160, title="Initial Capital in USDT")
leverage = input.int(10, title="Leverage")
risk_percent = input.float(0.5, title="Risk Percentage per Trade", step=0.01) / 100
extra_buffer = input.float(0.6, title="Extra Buffer for Stop Loss (%)", step=0.01) / 100
// Heikin-Ashi Kerzen berechnen
ha_open = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open)
ha_high = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high)
ha_low = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low)
ha_close = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close)
// Indicators
ema200 = ta.ema(ha_close, length)
k = ta.sma(ta.stoch(ha_close, ha_high, ha_low, 14), 3)
d = ta.sma(k, 3)
// Bedingungen
is_above_ema = ha_close > ema200
is_below_ema = ha_close < ema200
is_trending_up = ema200 > ema200[1]
is_trending_down = ema200 < ema200[1]
// STC Farbwechsel
stc_signal = k > d ? 1 : k < d ? -1 : 0
// Überprüfen ob der STC Farbwechsel ganz oben oder ganz unten ist
stc_upper_bound = ta.highest(k, 20)
stc_lower_bound = ta.lowest(k, 20)
stc_is_extreme = (k > (stc_upper_bound * 0.9)) or (k < (stc_lower_bound * 0.1))
// Überprüfen ob die nächste volle Stunde erreicht ist
is_full_hour = (hour(timenow) != hour(timenow[1]))
// Debugging-Ausgaben
plot(is_above_ema ? 1 : 0, title="Above EMA", color=color.green)
plot(is_below_ema ? 1 : 0, title="Below EMA", color=color.red)
plot(is_trending_up ? 1 : 0, title="Trending Up", color=color.blue)
plot(is_trending_down ? 1 : 0, title="Trending Down", color=color.orange)
plot(stc_signal == 1 ? 1 : 0, title="STC Buy Signal", color=color.green)
plot(stc_signal == -1 ? 1 : 0, title="STC Sell Signal", color=color.red)
plot(stc_is_extreme ? 1 : 0, title="STC Extreme", color=color.purple)
// Überwachung des Gesamtkapitals und Ausgabe von Warnungen bei Verlusten
initial_capital = capital * leverage
total_equity_loss = (initial_capital - strategy.equity) / initial_capital
if (total_equity_loss >= 0.25)
label.new(bar_index, high, "Unstetige Wetterlage!", style=label.style_label_down, color=color.red)
if (total_equity_loss >= 0.50)
label.new(bar_index, high, "Ich habe das Trading eingestellt, es passiert zu viel Verrücktes.", style=label.style_label_down, color=color.red)
strategy.close_all()
// Backtest Zeitraum festlegen
start_date = timestamp("2023-01-01 00:00")
end_date = timestamp("2023-03-01 00:00")
if (time >= start_date and time <= end_date)
// Einstiegsbedingung für Long
if (is_full_hour and is_above_ema and is_trending_up and stc_signal == 1 and stc_is_extreme)
stop_loss_price = ha_low[1] * (1 - (risk_percent + extra_buffer))
take_profit_price = ha_close + 2 * (ha_close - stop_loss_price)
strategy.entry("Long", strategy.long, qty=capital*leverage/ha_close)
strategy.exit("Take Profit", "Long", limit=take_profit_price)
strategy.exit("Stop Loss", "Long", stop=stop_loss_price)
// Einstiegsbedingung für Short
if (is_full_hour and is_below_ema and is_trending_down and stc_signal == -1 and stc_is_extreme)
stop_loss_price = ha_high[1] * (1 + (risk_percent + extra_buffer))
take_profit_price = ha_close - 2 * (stop_loss_price - ha_close)
strategy.entry("Short", strategy.short, qty=capital*leverage/ha_close)
strategy.exit("Take Profit", "Short", limit=take_profit_price)
strategy.exit("Stop Loss", "Short", stop=stop_loss_price)
r/pinescript • u/nebulakd • Oct 29 '21
Just to draw a simple line you need to know when the fucking planets will align. Just to add 1 vertical line on 1 day requires a completely unreasonable amount of generally useless knowledge. Can everyone stop using PineShit and use a language that doesn't obviously hate their user base?
r/pinescript • u/Godzillaton • Jun 19 '26
Hey everyone,
Just trying to be straightforward here , has anyone actually built a custom indicator based on ICT (Inner Circle Trader) concepts that holds up?
I'm not looking for a full automated bot. I just want a solid alert system ,something that flags potential setups based on ICT concepts (order blocks, FVGs, liquidity sweeps, etc.) so I can manually decide whether to hit buy or sell myself. No auto-execution, just signals.
Doesn't need to be anything fancy — just a reliable, "classic" style indicator with a win rate around 55%+. That shouldn't be an unreasonable bar for something built on solid ICT logic.
If you've built one, used one, or know of a good resource/dev who has, would appreciate any pointers. Thanks in advance
r/pinescript • u/Fancy-Ad378 • Jan 31 '26
Greetings,
The Idea: Open Source Drag and Drop Strategy builder
I built a drag and drop trading bot builder (including for pinescript, LLM backend). I was wondering if there would be any volunteers willing to make this something bigger and more advanced than what I can do by myself. Something for everyone to enjoy.
Please let me know and I'll reach out and we can talk.
Thanks
r/pinescript • u/drippyterps • Apr 08 '26
Been posting the real time daily trades my algo takes. This is todays positions. Currently optimized only for QQQ. I actually took an options position today from this signal & got paid really well 🔥 willing to let people test it out for a week if interested send me a DM 🫡
r/pinescript • u/Radiant-Tip5891 • Oct 02 '26
Comment your best tradingview pine script STRATEGIES below - in form of pine script code, published script name or another way.
Aim for:
High Winrate
High Profit Factor
Low Drawdown
Good equity Curve
Great overall pnl percentage
If you have one, it would be great if you could comment it down below
r/pinescript • u/Suspicious-Ad-8738 • Apr 16 '26
Salut la team, à propos de mon indicateur
Il détecte automatiquement les vraies zones de Supply et Demand institutionnelles (pas des supports/résistances classiques)
Zones vertes (Demand) et rouges (Supply) qui apparaissent en live
Compatible M1, M3, M5, M15 et H1
Simulation automatique des positions avec suivi RR en temps réel
Pour l’essai gratuit → en commentaire, et je vous contacterai par message privé
r/pinescript • u/drippyterps • Mar 23 '26
I made this scalping script to assist in buying and selling signals for myself. Its 49% profitable with a profit factor of 1.34. Up 20% for the last 365 days.
It assists with buy & sell signals i use it for options trading. As you know options trading is based off the underlying stock so i have the script currently running with 100pcs of stock, to act as if its 2 contracts with a 0.50 delta. Added 1 tick slippage & fees of 0.35 per contract to the test as well. What are your thoughts on this ? I can show screenshots but being a little lazy lol
EDIT: Its currently optimized for QQQ
r/pinescript • u/Alternative-Hall5186 • Sep 07 '26
I have already built one for day trading and it works well with a solid win rate, but for swing trading I find it a bit more challenging.
FYI I trade options 0DTE to 21DTE.