CSI.efs EFSLibrary - Discussion Board
File Name: CSI.efs
Description:
Commodity Selection Index
Formula Parameters:
PointValue: 50
Margin : 3000
Commission: 10
Length : 14
Notes:
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.
Download File:
CSI.efs
EFS Code:
/********************************* Provided By: eSignal (Copyright c eSignal), a division of Interactive Data Corporation. 2008. All rights reserved. This sample eSignal Formula Script (EFS) is for educational purposes only and may be modified and saved under a new file name. eSignal is not responsible for the functionality once modified. eSignal reserves the right to modify and overwrite this EFS file with each new release. Description: Commodity Selection Index Version: 1.0 12/15/2008 Formula Parameters: Default: PointValue 50 Margin 3000 Commission 10 Length 14 Notes: 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. **********************************/ var fpArray = new Array(); var bInit = false; function preMain() { setStudyTitle("Commodity Selection Index"); setCursorLabelName("CSI", 0); setDefaultBarFgColor(Color.green, 0); var x=0; fpArray[x] = new FunctionParameter("PointValue", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(50); } fpArray[x] = new FunctionParameter("Margin", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(3000); } fpArray[x] = new FunctionParameter("Commission", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(10); } fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(14); } } var xATR = null; var xADX = null; var xCSI = null; function main(PointValue, Margin, Commission, Length){ var nState = getBarState(); if (nState == BARSTATE_ALLBARS) { if (PointValue==null) PointValue = 50; if (Margin==null) Margin = 3000; if (Commission==null) Commission = 10; if (Length==null) Length = 14; } var K = 100 * ((PointValue / Math.sqrt(Margin) / (150 + Commission))); if(bInit==false){ xATR = atr(Length); xADX = adx(Length, Length); xCSI = efsInternal("calcCSI", K, Length, xATR, xADX) bInit = true; } if (getCurrentBarCount() < Length) return; return xCSI.getValue(0); } function calcCSI(K, Length, xATR, xADXR){ if (xADXR.getValue(-Length) == null) return; var nADXR = (xADXR.getValue(0) + xADXR.getValue(-Length)) * 0.5; var nCSI = K * xATR.getValue(0) * nADXR; return nCSI; }