Chaikin Money Flow Strategy

Research Paper on Trading Strategies Beside Calculator and Laptop

Chaikin Money Flow Strategy 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(“Chaikin Money Flow Strategy”, overlay=true)

// Input parameters
length = input.int(20, title=”Length”)
overbought_level = input.float(0.3, title=”Overbought Level”)
oversold_level = input.float(-0.3, title=”Oversold Level”)
target_points = input.int(100, title=”Target Points”)
stop_loss_points = input.int(50, title=”Stop Loss Points”)

// Calculate Money Flow Multiplier (MFM) and Money Flow Volume (MFV)
typical_price = (high + low + close) / 3
money_flow = typical_price * volume
positive_money_flow = ta.sma(money_flow * (ta.change(typical_price) > 0 ? 1 : 0), length)
negative_money_flow = ta.sma(money_flow * (ta.change(typical_price) < 0 ? 1 : 0), length)

// Calculate Chaikin Money Flow (CMF)
cmf_value = (positive_money_flow – negative_money_flow) / ta.sma(volume, length)

// Strategy logic
long_condition = ta.crossover(cmf_value, oversold_level)
short_condition = ta.crossunder(cmf_value, overbought_level)

// Plot CMF
plot(cmf_value, color=color.blue, title=”CMF”)

// 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 = high + target_points
long_stop_loss = low – stop_loss_points
short_target = low – target_points
short_stop_loss = high + 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