Strategy · Pine Script v4 · On the chart

BV's ICHIMOKU CLOUD SIGNAL TESTER

by hasnocool· code credited to vuagnouxb

This strategy plots an Ichimoku cloud on the price chart and opens long or short trades from a selectable crossover.

View on GitHub

GitHub stars106on the repository
Pine versionv4older, still runs
Lines of code80
Settings9inputs
LicenceGPL-3.0
Last update2 years ago18 Sep 2024

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

80 lines of Pine Script v4 from BV's ICHIMOKU CLOUD - All Signals.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

BV's ICHIMOKU CLOUD - All Signals.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © vuagnouxb
//@version=4
strategy("BV's ICHIMOKU CLOUD SIGNAL TESTER", overlay=true)
// Signal imputs 
signalChoice = input(title = "SIGNAL - Choose your signal", defval = "Tenkan/Kijun", options = ["Tenkan/Kijun", "Tenkan/Kijun+Kumo", "Price/Tenkan", "Price/Tenkan+Kumo", "Price/Kijun", "Price/Kijun+Kumo", "Price/Kumo", "Kumo Color"])
JPYPair = input(type = input.bool, title = "ATR - Check if JPY Pair ", defval = false)
//------------------------------------------------------------------------
//----------               ICHIMOKU CLOUD Calculation          ----------- INPUT
//------------------------------------------------------------------------
conversionPeriods = input(9, minval=1, title="Conversion Line Periods"),
basePeriods = input(26, minval=1, title="Base Line Periods")
laggingSpan2Periods = input(52, minval=1, title="Lagging Span 2 Periods"),
displacement = input(26, minval=1, title="Displacement")
donchian(len) => avg(lowest(len), highest(len))
conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)
plot(conversionLine, color=#0496ff, title="Conversion Line")
plot(baseLine, color=#991515, title="Base Line")
plot(close, offset = -displacement + 1, color=#459915, title="Lagging Span")
p1 = plot(leadLine1, offset = displacement - 1, color=color.green,
 title="Lead 1")
p2 = plot(leadLine2, offset = displacement - 1, color=color.red,
 title="Lead 2")
fill(p1, p2, color = leadLine1 > leadLine2 ? color.green : color.red)
kumoHigh = max(leadLine1[displacement-1], leadLine2[displacement-1])
kumoLow = min(leadLine1[displacement-1], leadLine2[displacement-1])
// -- Trade entry signals
continuationSignalLong = signalChoice == "Tenkan/Kijun" ? crossover(conversionLine, baseLine) :
   signalChoice == "Tenkan/Kijun+Kumo" ? crossover(conversionLine, baseLine) and close > kumoHigh : 
   signalChoice == "Price/Tenkan" ? crossover(close, conversionLine) : 
   signalChoice == "Price/Tenkan+Kumo" ? crossover(close, conversionLine) and close > kumoHigh :
   signalChoice == "Price/Kijun" ? crossover(close, baseLine) :
   signalChoice == "Price/Kijun+Kumo" ? crossover(close, baseLine) and close > kumoHigh : 
   signalChoice == "Price/Kumo" ? crossover(close, kumoHigh) :
   signalChoice == "Kumo Color" ? crossover(leadLine1, leadLine2) :
   false
   
continuationSignalShort = signalChoice == "Tenkan/Kijun" ? crossunder(conversionLine, baseLine) :
   signalChoice == "Tenkan/Kijun+Kumo" ? crossunder(conversionLine, baseLine) and close < kumoLow : 
   signalChoice == "Price/Tenkan" ? crossunder(close, conversionLine) : 
   signalChoice == "Price/Tenkan+Kumo" ? crossunder(close, conversionLine) and close < kumoLow :
   signalChoice == "Price/Kijun" ? crossunder(close, baseLine) :
   signalChoice == "Price/Kijun+Kumo" ? crossunder(close, baseLine) and close < kumoLow : 
   signalChoice == "Price/Kumo" ? crossunder(close, kumoLow) :
   signalChoice == "Kumo Color" ? crossunder(leadLine1, leadLine2) :
   false
longCondition = continuationSignalLong
shortCondition = continuationSignalShort
//------------------------------------------------------------------------
//----------             ATR MONEY MANAGEMENT                 ------------
//------------------------------------------------------------------------
SLmultiplier = input(title = "ATR - Stop Loss Multiplier", type = input.float, defval = 1.5, step = 0.1)
TPmultiplier = input(title = "ATR - Take Profit Multiplier", type = input.float, defval = 1.0, step = 0.1)
pipAdjuster = JPYPair ? 1000 : 100000
ATR = atr(14) * pipAdjuster // 1000 for jpy pairs : 100000
SL = ATR * SLmultiplier
TP = ATR * TPmultiplier
//------------------------------------------------------------------------
//----------                  TIME FILTER                     ------------
//------------------------------------------------------------------------
YearOfTesting = input(title = "Time - How many years of testing ?" , type = input.integer, defval = 3)
_time = 2020 - YearOfTesting
timeFilter = (year > _time) 
//------------------------------------------------------------------------
//---------                 ENTRY FUNCTIONS                    ----------- INPUT
//------------------------------------------------------------------------
if (longCondition and timeFilter)  
    strategy.entry("Long", strategy.long)
if (shortCondition and timeFilter) 
    strategy.entry("Short", strategy.short)
    
//------------------------------------------------------------------------
//---------                 EXIT  FUNCTIONS                    -----------
//------------------------------------------------------------------------
strategy.exit("ATR", from_entry = "Long", profit = TP, loss = SL)  
strategy.exit("ATR", from_entry = "Short", profit = TP, loss = SL)  
Expand (108 lines)

Overview

Signal choices cover Tenkan and Kijun, price against those lines or the cloud, and cloud color, with optional confirmation that price is beyond the Kumo. Conversion, base, lagging-span, and displacement lengths are adjustable. Settings also include ATR stop-loss and take-profit multipliers, a JPY-pair ATR toggle, and a testing-year input. The shown code ends before the ATR order logic, so the exit implementation is not visible.

Details

Published by

hasnocool on GitHub

Code credit

vuagnouxb, as written in the script's header

Type

Strategy, Pine Script v4

Draws

On the price chart

Category

Trend, Volatility & bands

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

analysisbtcusdtcryptocurrencydatapandaspythonsimulationtradingtradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
SIGNAL - Choose your signalstringTenkan/KijunsignalChoice
ATR - Check if JPY Pair boolfalseJPYPair
Conversion Line Periodsint9conversionPeriods
Base Line Periodsint26basePeriods
Lagging Span 2 Periodsint52laggingSpan2Periods
Displacementint26displacement
ATR - Stop Loss Multiplierfloat1.5SLmultiplier
ATR - Take Profit Multiplierfloat1.0TPmultiplier
Time - How many years of testing ?int3YearOfTesting
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

This strategy calculates Bollinger Bands and Aroon oscillator values to identify mean-reversion opportunities. It enters a long position using full equity when the closing price crosses below the lower Bollinger Band while Aroon Up remains above a user-specifi

Strategy v5 Mean reversionVolatility & bands
Updated 2 months ago · None stated GitHub repository of Bollinger bands + Aroon [Alorse]
257 stars

This overlay strategy targets one-minute ES futures and plots volume-weighted moving-average bands from the open, scaled by a standard-deviation multiple, plus a slower band from ten-minute opens. A higher-timeframe exponential moving average can filter trades

Strategy v6 Moving averagesVolatility & bands
Updated 6 weeks ago · None stated GitHub repository of ES - Futures 1M No Repaint

STRG-BBForce

by harryguiacorn
219 stars

STRG-BBForce is a Bollinger Bands trend-following strategy. It calculates standard Bollinger Bands and tracks directional alignment across the upper, lower, and basis lines. When all three lines slope upward, it opens a long position and closes short positions

Strategy v5 TrendVolatility & bands
Updated 1 year ago · None stated GitHub repository of STRG-BBForce

Nasdaq Prop Firm Strategy

by TradersPost
218 stars

This strategy uses multiple VWAP anchors and a custom Lull indicator to generate buy and sell signals on the Nasdaq price chart. It plots the VWAP trend line and three VWAP anchors with customizable colors and mitigation methods. The Lull indicator produces si

Strategy v6 TrendSupport & resistance Repaints
Updated 3 months ago · None stated GitHub repository of Nasdaq Prop Firm Strategy

This strategy implements a single-layer perceptron machine learning model built from scratch to generate trading signals directly on the price chart. It calculates predictions based on sample size, threshold settings, and optional volatility or volume filters.

Strategy v5 AI / machine learningTrend
Updated 1 year ago · None stated GitHub repository of Machine Learning: Perceptron-Based Strategy [5] (v.3)

Bollinger Bands Strategy

by cklose2000
105 stars

This strategy generates buy and sell signals based on Bollinger Band crossovers combined with a simple moving average trend filter. It enters a long position when price crosses above the lower band while trading above the SMA filter line, and enters a short po

Strategy v5 Volatility & bandsMoving averages
Updated 1 year ago · None stated GitHub repository of Bollinger Bands Strategy

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