OPEN-SOURCE SCRIPT
Hosoda Z

Hosoda’s Clouds is a trend-following strategy designed to trade only long positions in traditionally trending markets with a strong bullish bias: SPY(D); DJI (D); NDX (D); XAUUSD (D); Tesla (D, H4, H1); AAPL (D, H4, H1); GOOG (D, H4); META (D, H4); NVDA (D, H4); AMZN(D, H4).
Strategy Parameters
Initial Capital: $10,000 USD.
Position Size: Risks 10% of your equity per trade.
Commission: 0.1%
Indicators
The strategy combines two main technical tools:
A. Ichimoku Cloud This is the core of the strategy. It calculates the classic lines:
• Tenkan-sen (Fast Line): Average of the highest high and lowest low of the last 9 periods.
• Kijun-sen (Base Line): Average of the last 26 periods.
• Cloud (Senkou Span A and B): Projects future support/resistance.
B. EMA 500 (Trend Filter)
• A 500-period Exponential Moving Average is calculated.
• Function: Serves as a very long-term trend filter. If the price is above the EMA 500, the market is considered bullish in the long term.
Entry Rules
• Bullish Cross (Bull Cross): The fast line (Tenkan) crosses above the base line (Kijun). This is the classic Ichimoku entry signal.
•Trend Filter (Optional):
•If you check the "Enable EMA Filter" box in the options, the system will only buy if the closing price is above the EMA 500.
•If the box is unchecked, it will ignore the EMA and buy based solely on the Ichimoku cross.
Exit Rules
A. Stop Loss (Loss Protection) It is a dynamic Stop Loss based on market structure, not a fixed percentage.
• At the moment of entry, the code looks back 12 bars (configurable in sl_bars_back) and finds the lowest price (low).
• It places the Stop Loss at that minimum level.
• Visual: Draws a dotted red line on the chart showing where your Stop Loss is.
B. Technical Take Profit (Exit due to Weakness) Lets profits run until the trend shows weakness.
• Condition: Closes the trade if the Tenkan line crosses below the bottom of the Cloud.
• This means short-term momentum has been lost and the price has entered or crossed below the cloud.
Statistics Panel
In the top right corner, the code draws a table (Panel) that updates in real-time or at the end of Backtesting. It shows:
• Total P&L: Net profit or loss in dollars.
• Win Rate: Percentage of winning trades.
• Trades: Total number of trades executed.
Summary
1. The script waits for the blue line (Tenkan) to cross over the red line (Kijun).
2. It verifies if the price is above the orange line (EMA 500) (if the filter is active).
3. If so, it BUYS.
4. It immediately places a Stop Loss at the low of the last 12 candles (red dotted line).
5. It keeps the trade open until the Stop Loss is hit or until the Tenkan line drops below the Cloud.
Customizable Settings
• Whether to use the EMA filter or not.
• The EMA length (default is 500).
• The Ichimoku periods (9, 26, 52 are standard).
• How many bars to look back to set the Stop Loss.
Strategy Parameters
Initial Capital: $10,000 USD.
Position Size: Risks 10% of your equity per trade.
Commission: 0.1%
Indicators
The strategy combines two main technical tools:
A. Ichimoku Cloud This is the core of the strategy. It calculates the classic lines:
• Tenkan-sen (Fast Line): Average of the highest high and lowest low of the last 9 periods.
• Kijun-sen (Base Line): Average of the last 26 periods.
• Cloud (Senkou Span A and B): Projects future support/resistance.
B. EMA 500 (Trend Filter)
• A 500-period Exponential Moving Average is calculated.
• Function: Serves as a very long-term trend filter. If the price is above the EMA 500, the market is considered bullish in the long term.
Entry Rules
• Bullish Cross (Bull Cross): The fast line (Tenkan) crosses above the base line (Kijun). This is the classic Ichimoku entry signal.
•Trend Filter (Optional):
•If you check the "Enable EMA Filter" box in the options, the system will only buy if the closing price is above the EMA 500.
•If the box is unchecked, it will ignore the EMA and buy based solely on the Ichimoku cross.
Exit Rules
A. Stop Loss (Loss Protection) It is a dynamic Stop Loss based on market structure, not a fixed percentage.
• At the moment of entry, the code looks back 12 bars (configurable in sl_bars_back) and finds the lowest price (low).
• It places the Stop Loss at that minimum level.
• Visual: Draws a dotted red line on the chart showing where your Stop Loss is.
B. Technical Take Profit (Exit due to Weakness) Lets profits run until the trend shows weakness.
• Condition: Closes the trade if the Tenkan line crosses below the bottom of the Cloud.
• This means short-term momentum has been lost and the price has entered or crossed below the cloud.
Statistics Panel
In the top right corner, the code draws a table (Panel) that updates in real-time or at the end of Backtesting. It shows:
• Total P&L: Net profit or loss in dollars.
• Win Rate: Percentage of winning trades.
• Trades: Total number of trades executed.
Summary
1. The script waits for the blue line (Tenkan) to cross over the red line (Kijun).
2. It verifies if the price is above the orange line (EMA 500) (if the filter is active).
3. If so, it BUYS.
4. It immediately places a Stop Loss at the low of the last 12 candles (red dotted line).
5. It keeps the trade open until the Stop Loss is hit or until the Tenkan line drops below the Cloud.
Customizable Settings
• Whether to use the EMA filter or not.
• The EMA length (default is 500).
• The Ichimoku periods (9, 26, 52 are standard).
• How many bars to look back to set the Stop Loss.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
📖Revista El Especulador:
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
📖Revista El Especulador:
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.