Please can anyone convert this Tradestation indicator to MT4?
Cheers
{== START OF HEADER ==========================================================================
Program: RSI Major Trend System
Date: May 2011
Platform: TradeStation v9.0
DESCRIPTION:
Inspired by Peter Konner's article, "Combining RSI with RSI" in the
January 2011 issue of Technical Analysis of Stocks & Commodities.
This is a simple system that can be helpful in determining the marjor trend
in a given market by simply using RSI on a weekly chart.
This is not a complete trading system. Think of it as more
of an indicator. This system is designed for major indexes such as the
S&P and should be used on weekly data.
For more information see: http://www.systemtradersuccess.com
== END OF HEADER =============================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright 2011-2013. Capital Evolution, LLC. All Rights Reserved.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
== DEFINE ALL INPUTS AND VARIABLES ==========================================================}
[IntrabarOrderGeneration = False ]
inputs:
AccountSize(100000),
RiskPerTrade$(5000),
TrendRSILen(16),
RSIBuyLevel( 60),
RSISellLevel( 40) ;
variables:
vContracts(0),
RSI_Raw(0),
TriggerRSI( 0 ),
MarketTrend( 0 ) ;
RSI_Raw = RSI( (h+l+c)/3, TrendRSILen ) ;
TriggerRSI = XAverage( RSI_Raw, 3 );
vContracts = _CE_Normalize_Units_vs_Volatility( AccountSize, RiskPerTrade$, false, Close, 20, 3, false );
if TriggerRSI crosses above RSIBuyLevel Then Buy("LE") vContracts contracts next bar market;
if TriggerRSI crosses below RSISellLevel Then Sellshort("SE") vContracts contracts next bar market ;
{== END OF MAIN PROGRAM =====================================================================
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright 2011-2013. Capital Evolution, LLC. All Rights Reserved.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
{== START OF HEADER ==========================================================================
Function: _CE_Normalize_Units_vs_Volatility
Date: November 2012
Platform: TradeStation v9.1
DESCRIPTION:
This function is used for market studies to normalize the number of units traded vs.
the volatility of the market. Volatility is based upon an Average True Range calculation.
The lookback period and multiplicaation factor can be entered as inputs.
Version: November 2012 - Initial revision.
== END OF HEADER =============================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright 2012-2013. Capital Evolution, LLC. All Rights Reserved.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
== DEFINE ALL INPUTS AND VARIABLES ==========================================================}
inputs: {------------------------------------------------------------------------------------}
Account_Size$(numericsimple),
Risk_Per_Trade$(numericsimple),
RoundShares(TrueFalseSeries),
Entry_Price(numericsimple),
ATR_Lookback(numericsimple),
ATR_Mult(numericsimple),
Print_Results(TrueFalseSeries);
Variables:
symbolType(0),
STOCK(2),
MUTUALFUND(6),
ATR(0),
vUnits(0);
Once symbolType = Category;
ATR = AvgTrueRange(ATR_Lookback) * ATR_Mult * Bigpointvalue;
If ( ATR <> 0 ) Then vUnits = Intportion( Risk_Per_Trade$/ATR );
If ( vUnits * Entry_Price > Account_Size$ ) Then
vUnits = Intportion( Account_Size$/Entry_Price );
If (( symbolType = STOCK ) Or ( symbolType = MUTUALFUND )) And ( RoundShares ) Then
vUnits = Intportion(vUnits / 100 ) * 100;
If ( Print_Results ) Then
print( "Date: " + EEDateToString( Date )+ ", " +
"Time: " + EETimeToString( Time )+ ", " +
"Risk: " + numtostr(Risk_Per_Trade$,2) + " " +
"ATR: " + numtostr(ATR,2) + " " +
"Units: " + numtostr(vUnits,2)
);
_CE_Normalize_Units_vs_Volatility = vUnits;
{== END OF MAIN PROGRAM =====================================================================
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright 2009-2013. Capital Evolution, LLC. All Rights Reserved.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
Cheers
{== START OF HEADER ==========================================================================
Program: RSI Major Trend System
Date: May 2011
Platform: TradeStation v9.0
DESCRIPTION:
Inspired by Peter Konner's article, "Combining RSI with RSI" in the
January 2011 issue of Technical Analysis of Stocks & Commodities.
This is a simple system that can be helpful in determining the marjor trend
in a given market by simply using RSI on a weekly chart.
This is not a complete trading system. Think of it as more
of an indicator. This system is designed for major indexes such as the
S&P and should be used on weekly data.
For more information see: http://www.systemtradersuccess.com
== END OF HEADER =============================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright 2011-2013. Capital Evolution, LLC. All Rights Reserved.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
== DEFINE ALL INPUTS AND VARIABLES ==========================================================}
[IntrabarOrderGeneration = False ]
inputs:
AccountSize(100000),
RiskPerTrade$(5000),
TrendRSILen(16),
RSIBuyLevel( 60),
RSISellLevel( 40) ;
variables:
vContracts(0),
RSI_Raw(0),
TriggerRSI( 0 ),
MarketTrend( 0 ) ;
RSI_Raw = RSI( (h+l+c)/3, TrendRSILen ) ;
TriggerRSI = XAverage( RSI_Raw, 3 );
vContracts = _CE_Normalize_Units_vs_Volatility( AccountSize, RiskPerTrade$, false, Close, 20, 3, false );
if TriggerRSI crosses above RSIBuyLevel Then Buy("LE") vContracts contracts next bar market;
if TriggerRSI crosses below RSISellLevel Then Sellshort("SE") vContracts contracts next bar market ;
{== END OF MAIN PROGRAM =====================================================================
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright 2011-2013. Capital Evolution, LLC. All Rights Reserved.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
{== START OF HEADER ==========================================================================
Function: _CE_Normalize_Units_vs_Volatility
Date: November 2012
Platform: TradeStation v9.1
DESCRIPTION:
This function is used for market studies to normalize the number of units traded vs.
the volatility of the market. Volatility is based upon an Average True Range calculation.
The lookback period and multiplicaation factor can be entered as inputs.
Version: November 2012 - Initial revision.
== END OF HEADER =============================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright 2012-2013. Capital Evolution, LLC. All Rights Reserved.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
== DEFINE ALL INPUTS AND VARIABLES ==========================================================}
inputs: {------------------------------------------------------------------------------------}
Account_Size$(numericsimple),
Risk_Per_Trade$(numericsimple),
RoundShares(TrueFalseSeries),
Entry_Price(numericsimple),
ATR_Lookback(numericsimple),
ATR_Mult(numericsimple),
Print_Results(TrueFalseSeries);
Variables:
symbolType(0),
STOCK(2),
MUTUALFUND(6),
ATR(0),
vUnits(0);
Once symbolType = Category;
ATR = AvgTrueRange(ATR_Lookback) * ATR_Mult * Bigpointvalue;
If ( ATR <> 0 ) Then vUnits = Intportion( Risk_Per_Trade$/ATR );
If ( vUnits * Entry_Price > Account_Size$ ) Then
vUnits = Intportion( Account_Size$/Entry_Price );
If (( symbolType = STOCK ) Or ( symbolType = MUTUALFUND )) And ( RoundShares ) Then
vUnits = Intportion(vUnits / 100 ) * 100;
If ( Print_Results ) Then
print( "Date: " + EEDateToString( Date )+ ", " +
"Time: " + EETimeToString( Time )+ ", " +
"Risk: " + numtostr(Risk_Per_Trade$,2) + " " +
"ATR: " + numtostr(ATR,2) + " " +
"Units: " + numtostr(vUnits,2)
);
_CE_Normalize_Units_vs_Volatility = vUnits;
{== END OF MAIN PROGRAM =====================================================================
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright 2009-2013. Capital Evolution, LLC. All Rights Reserved.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}