Differenze tra le pagine "TS Confluence" e "TS Conner 19"

Da traderpedia.
(Differenze fra le pagine)
Jump to navigation Jump to search
imported>Stefano Fanton
 
imported>Stefano Fanton
 
Riga 1: Riga 1:
'''''Trading System "Confluence"'''''  
+
'''''Trading System "Conner 19"'''''  
 +
 
 +
Autore: Michael Conner
  
 
Formula per Tradestation™:  
 
Formula per Tradestation™:  
Riga 5: Riga 7:
 
INIZIO FORMULA  
 
INIZIO FORMULA  
  
Type : Function, Name : DerivativeMA
+
Type : System, Name : Conner 19
 
 
{ Function: DerivativeMA -- used by Confluence function }
 
 
 
Inputs: Price(numeric), Length(Numeric);<br>VARS: DERIV(0),SUMD(0),LENG2(0),N1(0),DR(0);<br>DERIV= (AVERAGE(Price,Length)*2) - AVERAGE(Price,Length)[1];<br>SUMD=Length*DERIV;<br>LENG2=length - 1 ;<br>N1= (AVERAGE(Price,LENG2))*LENG2;<br>DR=SUMD-N1;<br>DerivativeMA = DR;
 
 
 
<br>Type : Function, Name : Confluence
 
 
 
{Function: Confluence <br>Returns a value from -9 to +9.<br>-9 to -1: bearish<br>-0.9 to +0.9: "yellow"<br>1 to 9: bullish&nbsp;}
 
 
 
Input: price(Numeric),Harmonic(Numeric);
 
 
 
vars: STL(0),ITL(0),LTL(0),HOFF(0),SOFF(0),IOFF(0),LTOFF(0),Phase(1);<br>vars: mtl(0),momsig(0),mom(0),HT(0),HTA(0);<br>vars: ST(0),STA(0),IT(0),ITA(0),SUM(0),ERR(0),ERRSUM(0),ERRSIG(0),TC(0),TCSIG(0);<br>vars: ERRNUM(0),MOMNUM(0),TCNUM(0);<br>Vars: Havg(0), Savg(0), Iavg(0), Lavg(0);
 
 
 
{Calculate Lengths}<br>if (BarNumber = 1) then begin<br>MTL=harmonic/2;<br>STL= IntPortion((harmonic*2)-1); {11}<br>ITL= IntPortion((STL*2)-1); {21}<br>LTL= IntPortion((ITL*2)-1); {41}
 
 
 
HOFF=intportion(harmonic/2); {3}<br>SOFF=intportion(STL/2); {5}<br>IOFF=intportion(ITL/2); {10}<br>LTOFF=intportion(LTL/2); {20}<br>end;
 
 
 
{ Averages }
 
 
 
Havg = average(price, Harmonic);<br>Savg = average(price, STL);<br>Iavg = average(price, ITL);<br>Lavg = average(price, LTL);
 
 
 
{Cycle Momentum}
 
 
 
value2 = Savg - Havg[HOFF];<br>value3 = Iavg - Savg[SOFF];<br>value12 = Lavg - Iavg[IOFF];
 
 
 
momsig = value2 + value3 + value12; {Momentum Signal Line}
 
 
 
value5= ((summation(price,harmonic-1) + derivativema(price,harmonic))/harmonic);<br>value6= ((summation(price,STL-1) + derivativema(price,STL))/STL);<br>value7= ((summation(price,ITL-1) + derivativema(price,ITL))/ITL);<br>value13=((summation(avgprice,LTL-1) + derivativema(price,LTL))/LTL);
 
 
 
value9 = value6 - value5[HOFF];<br>value10=value7 - value6[SOFF];<br>value14=value13 - value7[IOFF];<br>mom = value9 + value10 + value14;
 
 
 
{ harmonic =6 was 5 may use harmonic -1 }<br>{<br>HT= sine((summation(price,(harmonic-1))+derivativema(price,harmonic))/harmonic) +<br>cosine((summation(price,(harmonic-1))+derivativema(price,harmonic))/harmonic);<br>}<br>HT = sine(value5) + cosine(value5);<br>HTA= sine(Havg) + cosine(Havg);
 
 
 
{<br>ST= sine((summation(price,(STL-1))+derivativema(price,STL))/ STL) +<br>cosine((summation(Price,(STL-1))+derivativema(Price,STL))/STL);<br>}<br>ST = sine(value6) + cosine(value6);<br>STA = sine(Savg) + cosine(Savg);
 
 
 
{<br>IT= sine((summation(price,(ITL-1))+derivativema(c,ITL))/ITL) +<br>cosine((summation(price,(ITL-1))+derivativema(Price,ITL))/ITL);<br>}<br>IT = sine(value7) + cosine(value7);<br>ITA=sine(Iavg)+ cosine(Iavg);
 
 
 
Sum= HT+ST+IT; {Est in Cyc Estimator/ Cycle Est Err = Sum - Err }<br>Err =HTA + STA +ITA;
 
 
 
{phase detect}
 
 
 
Condition2= (Sum &gt; Sum[SOFF]<br>and Havg &lt; Havg[SOFF])<br>OR (Sum &lt; Sum[SOFF]<br>and Havg &gt; Havg[SOFF]) ;<br>Phase=1;<br>if Condition2 then Phase=-1;
 
 
 
ErrSum = (Sum - Err)*phase; { ERROR OF THE CYCLE}<br>ErrSig=average(ErrSum,SOFF); { ERROR SIGNAL LINE}
 
 
 
{Trend Catcher}
 
 
 
value68=value5;<br>{( (summation(price,(harmonic-1)) + derivativema(price,harmonic)) / harmonic );}<br>value69=value13;<br>{( (summation(avgprice,(LTL-1)) + derivativema(price,LTL)) / LTL );}
 
 
 
value70 = value68-value69; { EST W Der}<br>value71 = average(value70,Harmonic);
 
 
 
TC =value70;<br>TCSig=value71;
 
 
 
{Begin Counting Bars}
 
 
 
If ErrSum &gt; 0 then begin<br>if Errsum &lt; ErrSum[1] and ErrSum &lt; ErrSig then ErrNum=1;<br>If ErrSum &lt;ErrSum[1] and ErrSum &gt;ErrSig then ErrNum=2;<br>If ErrSum&gt;ErrSum[1] and ErrSum&lt;ErrSig then ErrNum=2;<br>If ErrSum &gt; ErrSum[1] and ErrSum&gt; ErrSig then ErrNum=3;<br>End;<br>If ErrSum &lt; 0 then begin<br>if Errsum &gt; ErrSum[1] and ErrSum &gt; ErrSig then ErrNum=-1;<br>If ErrSum &lt;ErrSum[1] and ErrSum &gt;ErrSig then ErrNum=-2;<br>If ErrSum&gt;ErrSum[1] and ErrSum&lt;ErrSig then ErrNum=-2;<br>If ErrSum &lt; ErrSum[1] and ErrSum&lt; ErrSig then ErrNum=-3;<br>End;
 
 
 
If Mom &gt; 0 THEN begin<br>if mom &lt; mom[1] and mom &lt; momsig then momNum=1;<br>If mom &lt;mom[1] and mom &gt;momsig then momNum=2;<br>If mom&gt;mom[1] and mom&lt;momsig then momNum=2;<br>If mom &gt; mom[1] and mom&gt; momSig then momNum=3;<br>End;<br>If mom &lt; 0 then begin<br>if mom &gt; mom[1] and mom &gt; momSig then momNum=-1;<br>If mom &lt;mom[1] and mom &gt;momSig then momNum=-2;<br>If mom&gt;mom[1] and mom&lt;momSig then momNum=-2;<br>If mom &lt; mom[1] and mom&lt; momSig then momNum=-3;<br>End;
 
 
 
If TC &gt; 0 THEN begin<br>if TC &lt; TC[1] and TC &lt; TCsig then TCNum=1;<br>If TC &lt;TC[1] and TC &gt;TCsig then TCNum=2;<br>If TC&gt;TC[1] and TC&lt;TCsig then TCNum=2;<br>If TC &gt; TC[1] and TC&gt; TCSig then TCNum=3;<br>End;<br>If TC &lt; 0 then begin<br>if TC &gt; TC[1] and TC &gt; TCSig then TCNum=-1;<br>If TC &lt;TC[1] and TC &gt;TCSig then TCNum=-2;<br>If TC&gt;TC[1] and TC&lt;TCSig then TCNum=-2;<br>If TC &lt; TC[1] and TC&lt; TCSig then TCNum=-3;<br>End;
 
 
 
value42= ErrNum + MomNum+TCNum;
 
 
 
<br>Confluence = 0;<br>IF value42 &gt;0 and TC &gt;0 THEN Confluence = Value42; { Bullish }<br>IF value42&lt;0 and TC &lt; 0 THEN Confluence = Value42; { Bearish }<br>If (value42 &gt; 0 and tc &lt;0) or (value42 &lt;0 and tc&gt;0) then Confluence = Value42 / 10;
 
 
 
<br><br><br>
 
 
 
Type : Signal, Name : Confluence <br>{**** System: Confluence ****}
 
 
 
{<br>Based on Dale Legan's Confluence indicator that was posted to the Omega list in November 1998. See the Confluence function to see how the Conf oscillator is calculated.
 
 
 
Inputs:
 
 
 
Price: Price to use in the Confluence calculations.
 
 
 
Harmonic: Seems to be an estimate of the dominant cycle length?
 
 
 
Trigger: System buys/sells Trigger points above/below the bar where Confluence goes bullish/bearish. When the Confluence drops out of bullish/bearish mode, the system sets an exit stop Trigger points below Low / above High.
 
 
 
AggStops: If true, the system tightens its stops if the market moves in your direction. E.g. if High is 1000 and Trigger is 2, initial long stop is set at 1002. If the next bar has a high of 999, stop is moved to 999. }
 
 
 
{ These default input values seem to work well on 30-min SPX }
 
 
 
inputs: Price(Close), Harmonic(4), Trigger(5), AggStops(False);
 
 
 
Vars: Conf(0), Signal(0), Lstop(99999), Lexit(0), Sstop(0), Sexit(99999);
 
 
 
<br>{ Is the indicator in bull/bear mode? }
 
 
 
Conf = Confluence(Price, Harmonic);<br>Signal = 0;<br>if (Conf &gt;= 1) then Signal = 1; {bull}<br>if (Conf &lt;= -1) then Signal = -1; {bear}
 
 
 
{ Set entry stops when indicator first moves into bull/bear mode }
 
 
 
if (Signal = 1) and (Signal[1] &lt;&gt; 1) then begin<br>Lstop = High + Trigger;<br>Lexit = 0;<br>end;<br>if (Signal = -1) and (Signal[1] &lt;&gt; -1) then begin<br>Sstop = Low - Trigger;<br>Sexit = 99999;<br>end;
 
 
 
{ Set exit-position stops when indicator leaves bull/bear state }
 
 
 
if (Signal &lt;&gt; 1) and (Signal[1] = 1) then begin<br>Lexit = Low - Trigger;<br>Lstop = 99999;<br>end;<br>if (Signal &lt;&gt; -1) and (Signal[1] = -1) then begin<br>Sexit = High + Trigger;<br>Sstop = 0;<br>end;
 
 
 
{ Aggressive stops: move them if mkt moves in our direction }
 
 
 
if AggStops then begin<br>if (Lstop &lt;&gt; 99999) then Lstop = MinList(Lstop, High + Trigger);<br>if (Lexit &lt;&gt; 0) then Lexit = MaxList(Lexit, Low - Trigger);<br>if (Sstop &lt;&gt; 0) then Sstop = MaxList(Sstop, Low - Trigger);<br>if (Sexit &lt;&gt; 99999) then Sexit = MinList(Sexit, High + Trigger);<br>end;
 
  
{ Clear stops when our price is hit }
+
Input: LEConsec(4),SEConsec(4);<br>if MRO (close &lt;= Close[1],LEConsec,1)= -1 then<br>buy ("LE1") tomorrow at lowest (h,4) stop;<br>if MRO (close &gt;= Close[1],SEConsec,1)= -1 then<br>sell ("SE1") tomorrow at highest (l,4) stop;<br>{<br>if marketposition=1 then exitlong ("LX1")<br>from entry ("LE1") att highest(l,4)[1]limit;<br>if marketposition=-1 then exitshort ("sX1")<br>from entry ("SE1") att lowest(h,4)[1]limit;}  
  
if (H &gt; Lstop) then Lstop = 99999;<br>if (L &lt; Lexit) then Lexit = 0;<br>if (L &lt; Sstop) then Sstop = 0;<br>if (H &gt; Sexit) then Sexit = 99999;
+
{anchors stop to entrybar low and high}<br>if BarsSinceEntry &gt;0 then exitlong ("LX2") from entry ("LE1")<br>at$ low - 2 points stop;<br>if barsSinceEntry &gt;0 then exitshort ("SX2") from entry ("SE1")<br>at$ high + 2 points stop;
  
{ Issue the buy/sell order on each bar until price is hit }
+
{JKNote: Done in TradeStation PowerEditor, $1000 MM stop used, LX1 and SX1 coded but not used}
  
if (Lstop &lt;&gt; 99999) then buy at Lstop stop;<br>if (Lexit &lt;&gt; 0) then exitlong at Lexit stop;<br>if (Sstop &lt;&gt; 0) then sell at Sstop stop;<br>if (Sexit &lt;&gt; 99999) then exitshort at Sexit stop;<br><br>FINE FORMULA  
+
<br>FINE FORMULA  
  
 
== Vedi anche:  ==
 
== Vedi anche:  ==

Versione attuale delle 09:42, 22 mar 2012

Trading System "Conner 19"

Autore: Michael Conner

Formula per Tradestation™:

INIZIO FORMULA

Type : System, Name : Conner 19

Input: LEConsec(4),SEConsec(4);
if MRO (close <= Close[1],LEConsec,1)= -1 then
buy ("LE1") tomorrow at lowest (h,4) stop;
if MRO (close >= Close[1],SEConsec,1)= -1 then
sell ("SE1") tomorrow at highest (l,4) stop;
{
if marketposition=1 then exitlong ("LX1")
from entry ("LE1") att highest(l,4)[1]limit;
if marketposition=-1 then exitshort ("sX1")
from entry ("SE1") att lowest(h,4)[1]limit;}

{anchors stop to entrybar low and high}
if BarsSinceEntry >0 then exitlong ("LX2") from entry ("LE1")
at$ low - 2 points stop;
if barsSinceEntry >0 then exitshort ("SX2") from entry ("SE1")
at$ high + 2 points stop;

{JKNote: Done in TradeStation PowerEditor, $1000 MM stop used, LX1 and SX1 coded but not used}


FINE FORMULA

Vedi anche: