log in     sign up for free
 
To be a money master, you must first be a self-master.
J. P. Morgan
 
 
Home
systems (284)
 
 
Special offer: buy AmiBroker and EOD+Real-Time Data
 

Buy

MetaStock

     (special offer)
 
 
 

Buy

EOD data for MetaStock

     (special offer)
 
 
 

Buy

Realtime data for MetaStock

     (special offer)
 
 
 
 
Formula Library
 
AmiBroker
MetaTrader
MetaStock
TradeStation
Wealth-Lab
NinjaTrader
 
add your formula
System Library
 
 
Account login
Your email:
Password:
 
Log in
New to s4t? Sign up.
If you forgot your password click here.
Search the Web
 
Custom Search

Key Reversal Pattern

System for: TradeStation


 

 

Views:  2440

Added: May 30, 2007
 
Rate this code:  Rate: 1 Rate: 2 Rate: 3 Rate: 4 Rate: 5
This formula has not been rated yet
 
 

email this link

 
 
Tags: TradeStation, system
 
Your Ad Here
Massimiliano Scorpio's article "Finding Key Reversals" in this issue includes the EasyLanguage code for a key reversal-based strategy (a trading system) that also performs some basic statistical analysis to determine how often such price patterns occur and how often they lead to profitable moves. The strategy calls a custom function for identifying key reversals, and the EasyLanguage code for that is also included in the article.

While the ideas presented are sound, there are some issues with the code that may make it difficult to use as-is, so we are presenting an alternative version here. The key issues are:

The code will not run on the currently shipping TradeStation 6 platform because buy and sell statements are now written differently and stops are implemented internally in the EasyLanguage code instead of via external settings. (Some of the required changes are made automatically if you import the code from an ELS file, but if you are typing the code in, you need to make the changes yourself.)
The strategy has a drawback. The count of the number of times the KR is followed by an upmove is not valid. The way it is written, the count will actually reflect the number of times the high of the second bar of the two-bar KR was higher than the high of the first bar of the KR. Instead, it needs to pick up the number of times the high of the bar after the KR was higher than the high of the second bar of the KR.
The strategy uses "if LastCalcDate = Date" to determine if it is on the last bar of the chart. This will not work with intraday charts. It is preferable to use LastBarOnChart instead.
The exit statement should apply only to the bar after entry. The way it is written, it will apply to every bar.
If a profitable exit is not made on the bar after entry, there is no reason to stay in the trade until you are stopped out at a loss. Code has been added to exit the bar after entry on the close, if you have not already exited at a profit, and have not been stopped out.
For this application, the code for the KR function can be simplified considerably. This has been done, and the code (one statement) has been rolled in with the strategy code.
Several other minor simplifications and improvements were made.

 

 



Code:

Type : Strategy, Name : Key Reversal Pattern
Input: StopLossAmount( 250 ) ;

variable: KRPattern( false ) ;

KRPattern = Low < Low[1]
and Close > Close[1]
and Close < High ;

{ You are counting how many times the pattern recurs.
INCREMENT THE COUNT ONE BAR AFTER THE KR IS CONFIRMED. }

if KRPattern[1] then
begin
Value1 = Value1 + 1 ;

{ If there is a key reversal up pattern,
how many times is the following high greater or equal to the last high? }

if High >= High[1] then
Value2 = Value2 + 1 ;
end ;
{ Now send the results to a text file }

if LastBarOnChart then
begin
Print( File( "C:Patt.txt" ), GetSymbolName,
" ", ELDateToString( CurrentDate), " Time: ",
CurrentTime:4:0 ) ;
Print( File( "C:Patt.txt" ),
"Key Reversal Up Pattern" ) ;
if Value1 <> 0 then
begin
Print( File( "C:Patt.txt" ),
"Pattern ", Value1:4:0 ) ;
Print( File( "C:Patt.txt" ), "Total bars ",
BarNumber:4:0, " Observation on total bars ",
Value1 / BarNumber * 100, "%" ) ;
Print( File( "C:Patt.txt" ),
"Next high is greater or equal to prev high ",
Value2:4:0, Value2 / Value1 * 100, "%" ) ;
end ;
end ;

{ If you want to see trading signals include the code below }

if KRPattern then
begin
Buy this bar on Close ;
Sell ( "Target" ) next bar at High limit ;
end ;
SetStopPosition ;
SetStopLoss( StopLossAmount ) ;
if BarsSinceEntry = 1 then
Sell ( "EOD" ) this bar on Close ;


 






Author: Massimiliano Scorpio
Source: http://www.traders.com

 

View similar:

Fox31
NLR Volatility
Adaptive Moving Average System
Dual Time Frame Moving Average
Breakout Range2
E2 Bonder
Williams 19
High Percentage Trading System
Divergence
Keltner Channels
...
 
 
all systems for TradeStation
all systems

 

 

Email to friend

Top

 

     
However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators
and systems are submitted by anonymous users.
Therefore S4T™ does not take any responsibility for it's quality.
If you use any of this information, use it at your own risk. You are responsible for your own trading decisions.
Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade.
In no case will S4T™ be responsible for your trading gains or losses.
 
Privacy note | (c) copyrights systems4trading.com 2006-2012