YouTube Pine Script Lessons

Click the titles to see the source code and videos.

  • How To Create A Regime Filter

    This lesson demonstrates how you can use Pine Script to create a regime filter. A regime filter is an indicator that analyzes a major index or market leading asset class, and tells you when the overall market is "healthy" or "unhealthy".

  • Auto-Fibonacci Tool

    This lesson breaks down the AUTO-FIBONACCI tool created by the TradingView developers. I show how to adapt the source code from the inbuilt tool to customize it for your own purposes.

  • Pivots & Impulsive Moves

    This lesson demonstrates how we can use pivot detection in Pine Script in order to analyze impulsive moves in price action. Based on the TradingView zig-zag indicator code, this script uses a similar method for detecting price swings.

  • Tracking Ichimoku Base Line

    This lesson demonstrates how you can track the Ichimoku Cloud's Base Line to use as a support & resistance condition for detecting candlestick patterns around it when it's going horizontal.

  • A Simple Pullback Strategy

    This lesson demonstrates how to convert an extremely simple strategy idea into a Pine Script strategy script with a 75% win rate. This idea was inspired by Joe Marwood.

  • MACD Strategy + 2 Profit Targets

    This lesson demonstrates how I created a 2-target MACD trading strategy script for TradingView's Strategy Tester. I also share some of my thoughts on how I go about the process of vetting viable strategies to test.

  • Calculating Forex LOT SIZES

    This lesson demonstrates how to calculate forex lot sizes to be used in TradingView's Strategy Tester to get a more accurate representation of your strategy's historical performance.

  • Mean Reversion Strategy

    This video breaks down a Keltner Band Mean Reversion system I've been working on for my equity trading portfolio. It's a Daily timeframe long-only mean-reversion system designed to be traded on the U.S. stock market.

  • Referencing Lower Timeframes

    This lesson demonstrates how to access lower timeframe data. Specifically, in today's tutorial we are going to use arrays to reference the past 10 day's worth of ATR values on the Weekly and Monthly charts - but this technique works on all timeframes.

  • When to buy Crypto (Bitcoin Strategy)

    This lesson explains how I plan to manage my Bitcoin and altcoin investments in the cryptocurrency markets using a regime filter tool written in Pine Script. This tool keeps me invested during bull markets and in cash during bear markets.

  • How to Pyramid Trades

    This lesson expands on the Bitcoin Regime Filter Strategy by demonstrating how to enable pyramiding. "Pyramiding" is the practice of opening multiple positions in the same direction as your original trade.

  • How to draw Trade Labels

    This lesson answers a question from a student who wants to draw labels in a strategy script showing a closed trade's opening price, closing price, opening time, closing time and closed profit/loss.

  • Simple Moving Average Cross Strategy

    This lesson answers a question from a student who wants to get the closing price of a confirmed MA cross. I also turned it into a strategy, because why not?

  • ATR Volatility Analysis Tool

    This script compares short-term vol to longer-term vol to gauge relative volatility, and when short-term vol is elevated, it gives a green light to take trades.

  • How to Debug Pine Script

    This video explores various methods we can use to debug our Pine Script code when things aren't going to plan - including how to look inside For Loops.

  • Analyzing HTF Intraday

    This lesson demonstrates how to get the bar index of the intraday bar that created the previous day's higher-timeframe high. Once we have that bar index, we can analyze the bar however we like.

  • How to use Methods

    This lesson demonstrates how to create an array using custom data types and then how to sort it using a user-defined Method. Methods are much like user-defined functions, but even better!

  • How to Code Trailing Stops

    This lesson demonstrates various methods we can use to code trailing stop losses in Pine Script to lock in profits in strategy scripts - including ATR and Percentage-based variants with several parameters.

  • Day Trading Tool

    This lesson breaks down the source code to a tool I made to assist me when day trading forex markets. It plots key levels such as yesterday's high and low and the recent 5-day ATR's levels from the day's open price.

  • Detecting RSI Divergence

    This lesson demonstrates how to detect RSI divergence in Pine Script. This method can also be used for other oscillators, such as MACD, Stochastics and even On Balance Volume with some minor modifications.

  • Using Higher Timeframe Indicator Filters

    This lesson demonstrates how to use higher timeframe indicator values as market condition filters for your trading strategies. We use the 200-Day EMA and 5-Day RSI as a bullish filter on a 1HR chart.

  • Multi-Timeframe Trend Analysis

    This lesson demonstrates how to reference multiple timeframes in a Market Regime filter to gauge long-term momentum and directional bias.

  • Channel Breakout Strategy

    This lesson demonstrates how to code an extremely simple yet profitable Pine Script channel breakout strategy, and also teases a RealTest version of this script.

  • Multiple Timeframe Moving Averages

    Multi-timeframe indicators: this lesson demonstrates how to display 4 moving averages from 4 different timeframes without repainting in Pine Script.

  • Simple PineConnector Template

    This lesson breaks down the source code to a simple PineConnector template script that sends TradingView alerts to MetaTrader so we can automate our strategies.

  • Advanced PineConnector Template

    This lesson breaks down the source code to my Advanced PineConnector script template which includes the majority of PineConnector functionality inbuilt right into the Pine code.

  • How to Automate A TradingView Strategy Script

    This lesson demonstrates how to take an existing trading system and apply the Advanced PineConnector Template code to it to add full automation ability to any script that is compatible with the template.

  • Time Window Analysis

    This lesson demonstrates how to analyze price action within a specific window of time. It's a simple script, but it can easily be adapted to make a backtesting date filter.

  • Analyzing Afternoon vs. Morning Ranges

    This lesson explores a script I made to validate a hypothesis posed by a trader at SMB Capital regarding morning/afternoon ranges and trend-continuation.

  • RSI Overbought/Oversold Signals

    This short lesson breaks down how to detect overbought and oversold conditions in Pine Script - including how to generate alerts and trading signals.

  • Bitcoin Momentum Strategy

    This Pine Script lesson breaks down the source code to a Bitcoin Momentum trading system example template.

  • ATR Trailing Stop

    This lesson demonstrates a simple template for creating an ATR-based volatility-adaptive trailing stop in Pine Script.

  • How to Detect Pullbacks

    This lesson demonstrates how to detect high-quality trend-continuation pullbacks in price action using Pine Script code.

  • How to Detect Pre-Market Breakouts

    This lesson demonstrates how to analyze pre-market price action to detect overnight gaps higher in stocks.

  • Split Window Plots

    This lesson demonstrates how to use the force_overlay parameter to plot over the chart from a separate indicator pane.

  • PineConnector Automation Library

    This lesson breaks down how to use my PineConnector library. This page includes an example script template.

  • Monte Carlo Simulation

    This lesson demonstrates how to add basic Monte Carlo code into TradingView strategy scripts for backtesting.

  • Calculating Drawdown Duration

    This lesson demonstrates how to calculate the drawdown duration (in time) for your TradingView strategy scripts.

  • Crypto Arbitrage Indicator

    This script demonstrates how to utilize the new dynamic security function to create an arbitrage indicator.

  • Combined Broad Market Volume

    This lesson builds on the crypto arbitrage lesson to create an indicator which displays the aggregate volume for a single asset.

  • Analyzing the "Santa Rally"

    This one demonstrates how to build a date-range analysis indicator to calculate the average return over a seasonal time of year.


Educational Content Disclaimer

The content provided in our courses, including all code, lessons, and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context. Any results from strategies or tools provided are hypothetical and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and are not suitable for all persons. Before making any trading decisions, please consult with a qualified professional to understand the risks involved. By using our materials, you acknowledge and agree that any trading decisions are made solely at your discretion and risk. There is no guarantee whatsoever that our course material will result in financial gains for you.