đ Automate Your Crypto Trades with Token Metrics + Cryptohopper
Ready to turn insights into action? With the Token Metrics Indicator on TradingView and a connected Cryptohopper bot, you can automate trades based on AI-driven signals, 24/7, even while you sleep.
Letâs get everything set up step-by-step.
â What You Need Before You Start
Make sure you have the following:
A TradingView account on the Essential Plan or higher
Two-factor authentication enabled on your TradingView account
A Token Metrics account
Your TradingView username added to
Token Metrics â Settings â Trading View Details
This gives you access to the Token Metrics Indicator.
đ Add the Token Metrics Indicator on TradingView
Open the BTCUSDT chart on TradingView.
Add the Token Metrics Indicator from your Indicators menu.
Adjust the settings:
Order Size: Set to 100%, this means the full amount will be used in each trade.
Pyramiding: Set to 1, prevents the bot from entering multiple positions at once.
This setup ensures clean, single-entry trades without overlap.
đ¤ Set Up Your Cryptohopper Bot
Log in to Cryptohopper and go to Trading Bot.
Click âConfigure yourselfâ (top right).
Use these settings to get started:
Bot Basics
Name: Token Metrics Indicator Bot
Exchange: Choose Paper Trading to test it, or connect your live API keys
Buy Settings
Order Type: Market â so your orders are filled quickly when a signal triggers
Coins & Amounts
Quote Currency: USDT
Allowed Coin: BTC
Minimum Order Amount: 100 USDT
Nice and simple, buy BTC with USDT based on high-confidence signals.
đ Send Signals from TradingView to Cryptohopper
Now letâs connect the dots so your bot knows when to act.
In TradingView:
Click âAlertâ at the top.
Under Conditions, select the Token Metrics Indicator signal (e.g., BTCUSDT on 1D).
Choose how often to trigger the alert.
Set an expiration date for the alert.
Under Notifications, check âWebhook URLâ.
đĄ Reminder: Webhooks require TradingView Essential Plan or higher + 2FA enabled.
In Cryptohopper:
Go to Marketplace â Apps â TradingView.
Open the Alert Generator.
Configure the fields:
Bot: Select the one you're using
Symbol: Enter
BTC
(no quote currency needed)Action: Choose Buy or Sell
Order Type: Match your TradingView setting
Click Generate.
Copy the Alert Message that appears.
Paste it into the Message box in TradingViewâs alert.
Paste the Webhook URL from Cryptohopper into the Webhook field in TradingView.
Click Create.
Boomâyouâve just connected the Indicator to your bot.
đ§ Monitor Your Bot
Once the alert is live, your bot will begin reacting to Token Metrics signals automatically. You can monitor trades, track performance, and tweak your settings from the Cryptohopper dashboard.
đ§ž Full Pine Script
Youâll find the complete Token Metrics Indicator Pine Script below. Feel free to copy and study it, or link it into your personal workspace.
([// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// Š tokenmetrics//@version=5//Define Strategystrategy("Token Metrics Indicator", overlay=true, pyramiding = 4, default_qty_value=25, default_qty_type=strategy.percent_of_equity, initial_capital=1000)// Inputslong_term = input.bool(true, "long-term strategy (>= 1d)", group = "Strategy type")short_term = input.bool(false, "high-frequency strategy (<= 1h)", group = "Strategy type")trendline = input.bool(true, "show trendline", group = "Appearance")channel = input.bool(true, "show channel", group = "Appearance")strategyType = input.string("LongShort", "Strategy Type", options = ["LongShort", "LongOnly", "ShortOnly"])longOnly = strategyType == "LongOnly"shortOnly = strategyType == "ShortOnly"// Enter back testing periodstartDate = input.time(timestamp("2018-01-01T00:00:00"), "Start Date", group = "Back testing period")endDate = input.time(timestamp("2040-01-01T00:00:00"), "End Date", group = "Back testing period")backtestPeriod = if (time > startDate) and (time < endDate) true // forms part of entry conditionelse false // forms part of entry condition// check if current bar is after start date, BOOL// afterStartDate = time >= timestamp(syminfo.timezone, startYear, startMonth, startDate, 0, 0)// Short-term// Parametersinit = input.int(9, "Look-back Bars", group = "High-frequency parameters")high_factor = 0.3low_factor = 0.3stop = if short_term input.float(2, "Stop-loss(%)", group = "High-frequency parameters")*0.01// Adaptive Donchian Logic// Define functions (highest and lowest don't work with series__integer type)maximum(length) => out = high for i = 1 to length-1 out := math.max(out, high[i]) outminimum(length) => out = low for i = 1 to length-1 out := math.min(out, low[i]) out// Initialize variablesupn = initdnn = initupper = ta.highest(init)lower = ta.lowest(init)// update variables// upn := upper==high ? upn+adj : (lower==low ? upn-adj : upn)// dnn := upper==high ? dnn-adj : (lower==low ? dnn+adj : dnn)// upadj := round(upn*factor)// dnadj := round(dnn*factor)if upper == high upn := math.round(upn*high_factor) dnn := math.round(dnn*(1-low_factor))if lower == low upn := math.round(upn*(1-high_factor)) dnn := math.round(dnn*low_factor)if lower != low and upper != high upn := math.round(upn*(1-high_factor)) dnn := math.round(dnn*(1-low_factor))upper := maximum(upn)lower := minimum(dnn)upper_lag = upper[1]lower_lag = lower[1]// Plots// TM Channel (Adaptive Donchian Channel)col_channel = if channel color.new(#0073ff, 0)p1 = plot(upper, color = col_channel, title="Upper Channel")p2 = plot(lower, color= col_channel, title="Lower Channel")plot((upper+lower)/2, color=col_channel, title="Mid Channel")// Define conditions// longConditionlongCondition_short = ta.crossunder(close, lower_lag)// shortConditionshortCondition_short = ta.crossover(close, upper_lag)// Trading// StoplosslongLastClose = close[0]shortLastClose = close[0]// longStop = if long_term // input.float(8, "(long-term)Long Stop-loss(%)")*0.01// else if short_term // input.float(2, "(high-frequency)Long Stop-loss(%)")*0.01// Open positionif (longCondition_short and short_term and backtestPeriod) longLastClose := close strategy.entry("long", strategy.long)if (shortCondition_short and short_term and backtestPeriod) shortLastClose := close strategy.entry("short", strategy.short)// Trading stop-lossif (strategy.position_size > 0 and short_term) if close > longLastClose longLastClose := close strategy.exit(id="exit", stop=longLastClose * (1 - stop))if (strategy.position_size < 0 and short_term) if close < shortLastClose shortLastClose := close strategy.exit(id="exit", stop=shortLastClose * (1 + stop)) // Long-term// TM Trendline// Original Hilbert by everget : https://www.tradingview.com/script/aaWzn9bK-Ehlers-MESA-Adaptive-Moving-Averages-MAMA-FAMA/ {len = input(20, title='MA Length', group = "Long-term parameters")DClen = input(20, title='Channels Length', group = "Long-term parameters")src = input(close, title='Source', group = "Long-term parameters")PI = 2 * math.asin(1)fastclose = ta.sma(close, 1)hilbertTransform(src) => 0.0962 * src + 0.5769 * nz(src[2]) - 0.5769 * nz(src[4]) - 0.0962 * nz(src[6])computeComponent(src, mesaPeriodMult) => hilbertTransform(src) * mesaPeriodMultcomputeAlpha(src, fastLimit, slowLimit) => mesaPeriod = 0.0 mesaPeriodMult = 0.075 * nz(mesaPeriod[1]) + 0.54 smooth = 0.0 smooth := (4 * src + 3 * nz(src[1]) + 2 * nz(src[2]) + nz(src[3])) / 10 detrender = 0.0 detrender := computeComponent(smooth, mesaPeriodMult) // Compute InPhase and Quadrature components I1 = nz(detrender[3]) Q1 = computeComponent(detrender, mesaPeriodMult) // Advance the phase of I1 and Q1 by 90 degrees jI = computeComponent(I1, mesaPeriodMult) jQ = computeComponent(Q1, mesaPeriodMult) I2 = 0.0 Q2 = 0.0 // Phasor addition for 3 bar averaging I2 := I1 - jQ Q2 := Q1 + jI // Smooth the I and Q components before applying the discriminator I2 := 0.2 * I2 + 0.8 * nz(I2[1]) Q2 := 0.2 * Q2 + 0.8 * nz(Q2[1]) // Homodyne Discriminator Re = I2 * nz(I2[1]) + Q2 * nz(Q2[1]) Im = I2 * nz(Q2[1]) - Q2 * nz(I2[1]) Re := 0.2 * Re + 0.8 * nz(Re[1]) Im := 0.2 * Im + 0.8 * nz(Im[1]) if Re != 0 and Im != 0 mesaPeriod := 2 * PI / math.atan(Im / Re) mesaPeriod if mesaPeriod > 1.5 * nz(mesaPeriod[1]) mesaPeriod := 1.5 * nz(mesaPeriod[1]) mesaPeriod if mesaPeriod < 0.67 * nz(mesaPeriod[1]) mesaPeriod := 0.67 * nz(mesaPeriod[1]) mesaPeriod if mesaPeriod < 6 mesaPeriod := 6 mesaPeriod if mesaPeriod > 50 mesaPeriod := 50 mesaPeriod mesaPeriod := 0.2 * mesaPeriod + 0.8 * nz(mesaPeriod[1]) phase = 0.0 if I1 != 0 phase := 180 / PI * math.atan(Q1 / I1) phase deltaPhase = nz(phase[1]) - phase if deltaPhase < 1 deltaPhase := 1 deltaPhase alpha = fastLimit / deltaPhase if alpha < slowLimit alpha := slowLimit alpha [alpha, alpha / 2.0]// }er = math.abs(ta.change(src, len)) / math.sum(math.abs(ta.change(src)), len)[a, b] = computeAlpha(src, er, er * 0.1)mama = 0.0mama := a * src + (1 - a) * nz(mama[1])fama = 0.0fama := b * mama + (1 - b) * nz(fama[1])col_bull = if trendline color.new(#4CAF50, 70)col_bear = if trendline color.new(#FF5252, 70)mama_p = plot(mama, color=#00000000, title='MAMA')fama_p = plot(fama, color=#00000000, title='FAMA')fill(mama_p, fama_p, color=mama > fama ? col_bull : col_bear)alpha = math.pow(er * (b - a) + a, 2)kama = 0.0kama := alpha * src + (1 - alpha) * nz(kama[1])col = if trendline fixnan(kama > kama[1] ? color.green : kama < kama[1] ? color.red : na)// Donchian ChannelsHighs = ta.highest(high, DClen)[1]Lows = ta.lowest(low, DClen)[1]Mid = (Highs + Lows) / 2// conditionsupBrkOut = barstate.isconfirmed and ta.crossover(close, Highs)downBrkOut = barstate.isconfirmed and ta.crossover(close, Lows)plot(kama, color=col, linewidth=3, title='KAMA')// ConditionslongCondition_long2 = mama > famalongCondition_long = fastclose > kama// Tradingif (longCondition_long and longCondition_long2 and long_term and backtestPeriod and not shortOnly) // lbl = label.new(bar_index, low, "Long") // label.set_color(lbl, color.green) // label.set_yloc(lbl, yloc.belowbar) // label.set_style(lbl, label.style_label_up) strategy.entry('Long', strategy.long)shortCondition_long2 = fastclose < kamashortCondition_long = mama < famaCloseShortCondition = mama > famaif (shortCondition_long and shortCondition_long2 and long_term and backtestPeriod and not longOnly) // lbl = label.new(bar_index, high, "Short") //label.set_color(lbl, color.red) //label.set_yloc(lbl, yloc.abovebar) //label.set_style(lbl, label.style_label_down) strategy.entry('Short', strategy.short)plot(kama, color=col, linewidth=3, title='KAMA')ExitShort = ta.crossover(mama, fama)ExitLong = ta.crossover(fama, mama)if strategy.position_size < 0 and ExitShort and long_term strategy.exit(id='Close Short', stop=close)if strategy.position_size > 0 and ExitLong and long_term strategy.exit(id='Close Long', stop=close)// Close trade at last day of backtest// EndDate = time == timestamp(syminfo.timezone, 2022, 11, 24, 0, 0)// if EndDate// strategy.close_all()])
â ď¸ Read This Before You Trade
The Token Metrics Indicator is for educational purposes only. Itâs not investment advice or a guarantee of returns. Trading crypto carries risk, sometimes significant, and past performance doesnât predict future outcomes.
Please make sure you:
Understand the risks
Are trading within your financial means
Consult a professional if youâre unsure
By using this Indicator and automating trades via Cryptohopper, you accept full responsibility for all trading decisions.