Strategy · Pine Script v4 · Own pane

Currency test

by be-thomas

This strategy sets the account currency to euros and, after the year 2020, opens a long position of one thousand units.

View on GitHub

GitHub stars65on the repository
Pine versionv4older, still runs
Lines of code8
Settings0inputs
LicenceGPL-3.0
Last update4 days ago24 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

8 lines of Pine Script v4 from examples/v4/tradingview-docs/v4-essential-strategies-15.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

v4-essential-strategies-15.pine
//@version=4
strategy("Currency test", currency=currency.EUR)
if year > 2020
    strategy.entry("LE", true, 1000)
    strategy.exit("LX", "LE", profit=1, loss=1)
profit = strategy.netprofit
plot(abs((profit - profit[1])*100), "1 point profit", color=color.blue, linewidth=2)
plot(1 / close[1], "prev usdeur", color=color.red)

Overview

Currency test exits that position with a one-point profit target and a one-point stop. It plots the absolute bar-to-bar change in net profit, scaled by one hundred, and the inverse of the previous close, labeled as a previous euro-dollar rate. Both series draw in a separate pane. There are no user inputs.

Details

Published by

be-thomas on GitHub

Type

Strategy, Pine Script v4

Draws

Separate pane below the chart

Markets

Forex

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

algorithmic-tradingbacktestingcompilerfintechjavascriptpinescripttechnical-analysistradingview

Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

330 stars

HA UnivLong&Short Futures calculates Heikin Ashi candles and builds a channel using simple moving averages of Heikin Ashi highs and lows. It enters long positions when the upper channel line crosses above the lower channel line and opens short positions on the

Strategy v5 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of HA UnivLong&Short Futures

Q-Trend + KVO Strategy

by TradersPost
218 stars

This strategy combines the ATR-banded Q-Trend indicator with the Klinger Volume Oscillator (KVO) to execute confluence trades. It enters long when a Q-Trend buy trigger aligns with a positive KVO value and a bullish candle confirmation, taking short trades und

Strategy v6 TrendVolume
Updated 3 months ago · None stated GitHub repository of Q-Trend + KVO Strategy

MACD Crossover (tutorial)

by pineforge-4pass
193 stars

This strategy calculates the Moving Average Convergence Divergence indicator and plots the MACD line, signal line, and histogram in a separate pane. It enters long positions when the MACD line crosses above the signal line and enters short positions when it cr

Strategy v6 Oscillators & momentumMoving averages
Updated today · Apache-2.0 GitHub repository of MACD Crossover (tutorial)
114 stars

This strategy estimates price behavior using ordinary least squares regression between higher-timeframe data and a generated dataset, smoothed by a Karobein oscillator. It enters long positions when the oscillator turns upward and short positions when it turns

Strategy v4 Oscillators & momentumAI / machine learning Repaints

10PreBuyer

by hasnocool
106 stars

10PreBuyer is a dip-buying strategy that submits limit orders below recent price action using a discounted Hull Moving Average (HMA). It calculates the highest HMA value of high prices over a selected period, multiplied by a percentage discount factor, and pla

Strategy v4 Moving averagesMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of 10PreBuyer

Pair Trade: Apple & Google

by PythonForForex
64 stars

This pair trading strategy calculates the daily price movement ratio of Google using multi-symbol data requests and plots it in a separate pane. When Google drops by more than 5% within a day, the strategy enters a long position of 100 units on the chart symbo

Strategy v5 Mean reversion
Updated 4 years ago · None stated GitHub repository of Pair Trade: Apple & Google

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers