Kozlod - Yet Another Moving Average Cross Strategy (9 MA types)
Mar 6, 2018

The Kozlod - Yet Another Moving Average Cross Strategy indicator provides a versatile backtesting framework for executing trend-following trades based on the crossover of two moving averages, offering nine different calculation types and integrated risk management.
Usage
The Usage section describes how the script can be used, examples should be provided in this section. This section also focuses on how main settings affect the indicator interpretation and output.
Users can employ this tool to identify trend reversals and momentum shifts by observing the interaction between a fast (Short) and slow (Long) moving average. A common example involves selecting the "EMA" type with a 9-period Short MA and a 21-period Long MA; a long entry is triggered when the 9-EMA crosses above the 21-EMA, while a short entry occurs on a cross below.
The indicator also visualizes trade execution levels directly on the chart. When a signal is generated, the tool marks the entry price, stop-loss level, and profit target level using cross-shaped markers. This allows traders to visually assess the risk-to-reward ratio and the frequency of price reaching specific percentage-based targets.
Details
The script executes calculations for various moving average methodologies, ensuring flexibility across different market conditions. The logic is designed to compute two distinct lines based on user-defined sources and lengths.
- Calculation Logic: The strategy triggers a long entry when the Short MA value becomes greater than the Long MA value. Conversely, it triggers a short entry when the Short MA value becomes less than the Long MA value.
- Risk Management: The strategy includes built-in logic for Stop Loss (SL) and Profit Target (PT). These are calculated as a percentage offset from the entry price (the opening price of the bar following the signal).
- Supported MA Types:
- Simple Moving Average (SMA)
- Exponential Moving Average (EMA)
- Weighted Moving Average (WMA)
- Arnaud Legoux Moving Average (ALMA)
- Hull Moving Average (HMA)
- Volume-weighted Moving Average (VWMA)
- Least Square Moving Average (LSMA)
- Smoothed Moving Average (SMMA)
- Double Exponential Moving Average (DEMA)
This script is based on original code by QuantNomad and has been refactored for optimized performance and visual clarity.
Settings
- MA Type: Selects the specific mathematical formula used to calculate both moving averages.
- Short MA Length: Determines the lookback period for the fast-moving average.
- Short MA Source: The price data (e.g., Close, Open, High, Low) used for the fast MA calculation.
- Long MA Length: Determines the lookback period for the slow-moving average.
- Long MA Source: The price data used for the slow MA calculation.
- ALMA Offset: Controls the smoothness and responsiveness of the Arnaud Legoux Moving Average (only active when ALMA is selected).
- ALMA Sigma: Adjusts the standard deviation of the ALMA filter (only active when ALMA is selected).
- LSMA Offset: Shifts the Least Square Moving Average calculation forward or backward in time.
- SL Level %: Sets a percentage-based stop loss; a value of 0 disables this feature.
- PT Level %: Sets a percentage-based profit target; a value of 0 disables this feature.
FAQ
How do I interpret the colored lines on the chart? The red line represents the Short Moving Average, while the green line represents the Long Moving Average. Crossovers between these two lines dictate the entry signals.
Can I use different sources for the short and long averages? Yes, the settings allow you to define independent sources for each average, such as using the "High" for the short MA and the "Low" for the long MA.
How can I access the Kozlod - Yet Another Moving Average Cross Strategy? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.