Differenze tra le pagine "TS Keltner Channels" e "TS Key Reversal Pattern"

Da traderpedia.
(Differenze fra le pagine)
Jump to navigation Jump to search
imported>Stefano Fanton
 
imported>Stefano Fanton
 
Riga 1: Riga 1:
'''''Trading System "Keltner Channels"'''''  
+
'''''Trading System "Key Reversal Pattern"'''''  
 +
 
 +
Codice in EasyLanguage per una strategia basata sul key reversal pattern.
  
 
Formula per Tradestation™:  
 
Formula per Tradestation™:  
Riga 5: Riga 7:
 
INIZIO FORMULA  
 
INIZIO FORMULA  
  
Type : Signal, Name : Keltner Channels <br>Inputs: Len(25),Fc(1.75);<br>Vars: Upper(0),Lower(0),Mid(0),Rng(0),Dif(0);  
+
Type : Strategy, Name : Key Reversal Pattern <br>Input: StopLossAmount( 250 ) ;
 +
 
 +
variable: KRPattern( false ) ;
 +
 
 +
KRPattern = Low &lt; Low[1]<br>and Close &gt; Close[1]<br>and Close &lt; High ;
 +
 
 +
{ You are counting how many times the pattern recurs. <br>INCREMENT THE COUNT ONE BAR AFTER THE KR IS CONFIRMED. }
 +
 
 +
if KRPattern[1] then<br>begin<br>Value1 = Value1 + 1 ;
 +
 
 +
{ If there is a key reversal up pattern, <br>how many times is the following high greater or equal to the last high? }
 +
 
 +
if High &gt;= High[1] then<br>Value2 = Value2 + 1 ;<br>end ;<br>{ Now send the results to a text file }
  
Rng=XAverage(TrueRange,Len);<br>Mid=Xaverage(C,Len);<br>Upper=Mid+Fc*Rng;<br>Lower=Mid-Fc*Rng;<br>Dif=Close-Mid;
+
if LastBarOnChart then<br>begin<br>Print( File( "C:\Patt.txt" ), GetSymbolName,<br>" ", ELDateToString( CurrentDate), " Time: ",<br>CurrentTime:4:0 ) ;<br>Print( File( "C:\Patt.txt" ),<br>"Key Reversal Up Pattern" ) ;<br>if Value1 &lt;&gt; 0 then<br>begin<br>Print( File( "C:\Patt.txt" ),<br>"Pattern ", Value1:4:0 ) ;<br>Print( File( "C:\Patt.txt" ), "Total bars ",<br>BarNumber:4:0, " Observation on total bars ",<br>Value1 / BarNumber * 100, "%" ) ;<br>Print( File( "C:\Patt.txt" ),<br>"Next high is greater or equal to prev high ",<br>Value2:4:0, Value2 / Value1 * 100, "%" ) ;<br>end ;<br>end ;
  
Condition1=Dif crosses above 0;<br>Condition2=Dif crosses below 0;<br>Condition3=Dif crosses below Fc*Rng;<br>Condition4=Dif crosses above -Fc*Rng;
+
{ If you want to see trading signals include the code below }
  
If condition1 then buy on close;<br>If condition3 then exitlong on close;<br>If condition2 then sell on close;<br>If condition4 then exitshort on close;<br><br>FINE FORMULA  
+
if KRPattern then<br>begin<br>Buy this bar on Close ;<br>Sell ( "Target" ) next bar at High limit ;<br>end ;<br>SetStopPosition ;<br>SetStopLoss( StopLossAmount ) ;<br>if BarsSinceEntry = 1 then<br>Sell ( "EOD" ) this bar on Close ;<br><br>FINE FORMULA  
  
 
== Vedi anche:  ==
 
== Vedi anche:  ==

Versione attuale delle 09:48, 22 mar 2012

Trading System "Key Reversal Pattern"

Codice in EasyLanguage per una strategia basata sul key reversal pattern.

Formula per Tradestation™:

INIZIO FORMULA

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 ;

FINE FORMULA

Vedi anche: