
A estratégia do Commodity Selection Index (CSI) é uma estratégia de negociação em linha curta que acompanha a dinâmica do mercado. Ela identifica commodities com forte dinâmica de negociação, calculando a tendência e a volatilidade das commodities. A estratégia foi desenvolvida por Welles Wilder em seu livro New Technology Analysis Trading System Concepts.
O indicador central da estratégia é o índice CSI, que leva em consideração a tendência e a volatilidade dos produtos. Os métodos de cálculo são:
CSI = K × ATR × (ADX + n linha média diária de ADX) / 2
K é o coeficiente de escala, ATR representa a média real de flutuação, que mede a volatilidade do mercado. ADX representa o índice de direção média, que reflete a tendência do mercado.
Computação do índice de CSI de cada commodity e comparação com sua média móvel simples de n dias, gerando um sinal de compra quando o CSI está acima de sua média móvel e um sinal de venda quando o CSI está abaixo de sua média móvel.
A estratégia escolhe commodities com índices mais altos do CSI para negociar. Como esses commodities têm uma forte tendência e volatilidade, podem obter maior potencial de lucro em curto prazo.
A estratégia tem as seguintes vantagens:
A estratégia também apresenta alguns riscos:
Para controlar o risco, deve-se razoavelmente definir a posição de parada, controlar o tamanho da posição individual e ajustar adequadamente os parâmetros para adaptar-se a diferentes condições de mercado.
A estratégia pode ser melhorada em vários aspectos:
A estratégia do índice de escolha de commodities dinâmicas permite negociações de linha curta simples e rápidas, capturando commodities de forte tendência e volatilidade no mercado. Esta abordagem especializada em rastrear a dinâmica torna seus sinais claros e fáceis de implementar.
/*backtest
start: 2023-10-28 00:00:00
end: 2023-11-27 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 20/03/2019
// The Commodity Selection Index ("CSI") is a momentum indicator. It was
// developed by Welles Wilder and is presented in his book New Concepts in
// Technical Trading Systems. The name of the index reflects its primary purpose.
// That is, to help select commodities suitable for short-term trading.
// A high CSI rating indicates that the commodity has strong trending and volatility
// characteristics. The trending characteristics are brought out by the Directional
// Movement factor in the calculation--the volatility characteristic by the Average
// True Range factor.
// Wilder's approach is to trade commodities with high CSI values (relative to other
// commodities). Because these commodities are highly volatile, they have the potential
// to make the "most money in the shortest period of time." High CSI values imply
// trending characteristics which make it easier to trade the security.
// The Commodity Selection Index is designed for short-term traders who can handle
// the risks associated with highly volatile markets.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
fADX(Len) =>
up = change(high)
down = -change(low)
trur = rma(tr, Len)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, Len) / trur)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, Len) / trur)
sum = plus + minus
100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), Len)
strategy(title="Commodity Selection Index Backtest", shorttitle="CSI Backtest")
PointValue = input(50)
Margin = input(3000)
Commission = input(10)
Length = input(14)
reverse = input(false, title="Trade reverse")
K = 100 * ((PointValue / sqrt(Margin) / (150 + Commission)))
xATR = atr(Length)
xADX = fADX(Length)
nADXR = (xADX + xADX[Length]) * 0.5
xCSI = K * xATR * nADXR
xMACSI = sma(xCSI, Length)
pos = 0.0
pos := iff(xCSI < xMACSI, 1,
iff(xCSI > xMACSI, -1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(xCSI, color=green, title="CSI")
plot(xMACSI, color=red, title="CSI SMA")