Ichimoku Cloud Strategy

Research Paper on Trading Strategies Beside Calculator and Laptop

Ichimoku Cloud Strategy Indicator Pinescript

These strategies are for demonstration purposes only and are not intended for actual trading. Saanmi Capital is not responsible for any profit or loss arising from the use of these sample strategies.

//@version=5
strategy(“Ichimoku Cloud Strategy”, overlay=true)

// Input parameters
conversion_period = input.int(9, title=”Conversion Line Period”)
base_period = input.int(26, title=”Base Line Period”)
lagging_span2_period = input.int(52, title=”Lagging Span 2 Period”)
displacement = input.int(26, title=”Displacement”)
target_points = input.int(100, title=”Target Points”)
stop_loss_points = input.int(50, title=”Stop Loss Points”)

// Calculate Ichimoku Cloud
tenkan_sen = ta.sma((high + low) / 2, conversion_period)
kijun_sen = ta.sma((high + low) / 2, base_period)
senkou_span_a = ((tenkan_sen + kijun_sen) / 2)[displacement]
senkou_span_b = ta.sma((high + low) / 2, lagging_span2_period)[displacement]

// Strategy logic
long_condition = close > senkou_span_a and close > senkou_span_b
short_condition = close < senkou_span_a and close < senkou_span_b

// Plot Ichimoku Cloud
plot(senkou_span_a, color=color.blue, title=”Senkou Span A”)
plot(senkou_span_b, color=color.red, title=”Senkou Span B”)

// Strategy entry
if long_condition
strategy.entry(“Long”, strategy.long)
if short_condition
strategy.entry(“Short”, strategy.short)

// Calculate target and stop loss levels
long_target = strategy.position_avg_price + target_points
long_stop_loss = strategy.position_avg_price – stop_loss_points
short_target = strategy.position_avg_price – target_points
short_stop_loss = strategy.position_avg_price + stop_loss_points

// Strategy exit
strategy.exit(“Long Exit”, “Long”, limit=long_target, stop=long_stop_loss)
strategy.exit(“Short Exit”, “Short”, limit=short_target, stop=short_stop_loss)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top