PureBytes Links
Trading Reference Links
|
This is a Indicator Called confluence, It Ranges from +9 to -9 . It exhibits descrepancies between what is plotted IE when as an indicator and as used in a system. I may want to move a stop or enter a position on a stop above high or below low on a bar when a +9 or -9 is registered.
It uses a function called Derivativema which is below as well.
****Confluence****
vars:STL(0),ITL(0),LTL(0),HOFF(0),SOFF(0),IOFF(0),LTOFF(0),Phase(1),mtl(0),momsig(0),mom(0),HT(0),HTA(0),
ST(0),STA(0),IT(0),ITA(0),SUM(0),ERR(0),ERRSUM(0),ERRSIG(0),TC(0),TCSIG(0), ERRNUM(0),MOMNUM(0),TCNUM(0);
Input: price(numeric),Harmonic(numeric);
if security then begin
{Calculate Lengths}
MTL=harmonic/2;
STL= IntPortion((harmonic*2)-1); {11}
ITL= IntPortion((STL*2)-1); {21}
LTL= IntPortion((ITL*2)-1); {41}
HOFF=intportion(harmonic/2); {3}
SOFF=intportion(STL/2); {5}
IOFF=intportion(ITL/2); {10}
LTOFF=intportion(LTL/2); {20}
{Cycle Momentum}
value2 = average(price,STL) - average(price,Harmonic)[HOFF];
value3 = average(price,ITL) - average(price,STL)[SOFF];
value12 = average(price,LTL)-average(price,ITL)[IOFF];
momsig = value2 + value3 + value12; {Signal Line}
value5= ((summation(price,harmonic-1) + derivativema(price,harmonic))/harmonic);
value6= ((summation(price,STL-1) + derivativema(price,STL))/STL);
value7= ((summation(price,ITL-1) + derivativema(price,ITL))/ITL);
value13=((summation(avgprice,LTL-1) + derivativema(price,LTL))/LTL);
value9 = value6 - value5[HOFF];
value10=value7 - value6[SOFF];
value14=value13 - value7[IOFF];
mom = value9 + value10 + value14;
{ harmonic =6 was 5 may use harmonic -1 }
HT= sine((summation(price,(harmonic-1))+derivativema(price,harmonic))/harmonic) + cosine((summation(price,(harmonic-1))+derivativema(price,harmonic))/harmonic);
HTA= sine(average(price,harmonic)) +cosine(average(price,harmonic));
ST= sine((summation(price,(STL-1))+derivativema(price,STL))/ STL) + cosine((summation(Price,(STL-1))+derivativema(Price,STL))/STL);
STA = sine(average(price,STL)) + cosine(average(price,STL));
IT= sine((summation(price,(ITL-1))+derivativema(c,ITL))/ITL) + cosine((summation(price,(ITL-1))+derivativema(Price,ITL))/ITL);
ITA=sine(average(price,ITL))+ cosine(average(price,ITL));
Sum= HT+ST+IT; {Est in Cyc Estimator/ Cycle Est Err = Sum - Err }
Err =HTA + STA +ITA;
{phase detect}
Condition2=(Sum > Sum[SOFF] and average(price,harmonic) < average(price,harmonic)[SOFF]) OR (Sum < Sum[SOFF] and average(price,harmonic) > average(price,harmonic)[SOFF]) ;
Phase=1;
if Condition2 then Phase=-1;
ErrSum = (Sum - Err)*phase; { ERROR OF THE CYCLE}
ErrSig=average(ErrSum,SOFF); { ERROR SIGNAL LINE}
{Trend Catcher}
value68=( (summation(price,(harmonic-1)) + derivativema(price,harmonic)) / harmonic );
value69=( (summation(avgprice,(LTL-1)) + derivativema(price,LTL)) / LTL );
value70 = value68-value69; { EST W Der}
value71 = average(value70,Harmonic);
TC =value70;
TCSig=value71;
{Begin Counting Bars}
If ErrSum > 0 then begin
if Errsum < ErrSum[1] and ErrSum < ErrSig then ErrNum=1;
If ErrSum <ErrSum[1] and ErrSum >ErrSig then ErrNum=2;
If ErrSum>ErrSum[1] and ErrSum<ErrSig then ErrNum=2;
If ErrSum > ErrSum[1] and ErrSum> ErrSig then ErrNum=3;
End;
If ErrSum < 0 then begin
if Errsum > ErrSum[1] and ErrSum > ErrSig then ErrNum=-1;
If ErrSum <ErrSum[1] and ErrSum >ErrSig then ErrNum=-2;
If ErrSum>ErrSum[1] and ErrSum<ErrSig then ErrNum=-2;
If ErrSum < ErrSum[1] and ErrSum< ErrSig then ErrNum=-3;
End;
If Mom > 0 THEN begin
if mom < mom[1] and mom < momsig then momNum=1;
If mom <mom[1] and mom >momsig then momNum=2;
If mom>mom[1] and mom<momsig then momNum=2;
If mom > mom[1] and mom> momSig then momNum=3;
End;
If mom < 0 then begin
if mom > mom[1] and mom > momSig then momNum=-1;
If mom <mom[1] and mom >momSig then momNum=-2;
If mom>mom[1] and mom<momSig then momNum=-2;
If mom < mom[1] and mom< momSig then momNum=-3;
End;
If TC > 0 THEN begin
if TC < TC[1] and TC < TCsig then TCNum=1;
If TC <TC[1] and TC >TCsig then TCNum=2;
If TC>TC[1] and TC<TCsig then TCNum=2;
If TC > TC[1] and TC> TCSig then TCNum=3;
End;
If TC < 0 then begin
if TC > TC[1] and TC > TCSig then TCNum=-1;
If TC <TC[1] and TC >TCSig then TCNum=-2;
If TC>TC[1] and TC<TCSig then TCNum=-2;
If TC < TC[1] and TC< TCSig then TCNum=-3;
End;
value42= ErrNum + MomNum+TCNum;
confluence=value42;
end;
**Function DErivativema ****
Inputs: Price(Numeric), Length(Numeric);
if security then begin
VARS: DERIV(0),SUMD(0),LENG2(0),N1(0),DR(0);
DERIV= ((AVERAGE(Price,Length))*2) - AVERAGE(Price,Length)[1];
SUMD=Length*DERIV;
LENG2=length - 1 ;
N1= (AVERAGE(Price,LENG2))*LENG2;
DR=SUMD-N1;
DerivativeMA = DR;
end;
-----Original Message-----
From: SKane777@xxxxxxx [SMTP:SKane777@xxxxxxx]
Sent: Thursday, November 05, 1998 10:44 AM
To: Orphelin@xxxxxxx; Omega-list@xxxxxxxxxx
Subject: Re: Construction of trading signals
We use an intraday system (2 min bars) on TS, developed 4 years ago and
traded realtime for the past two years. A friend of mine who is the one of
the head programmers for one of the large computer firms here in Austin
programmed the system for me. He did not like the TS 13,000 bar limit, so he
exported all the data (3 data inputs) for 2 years into an ascii file and re-
programmed the TS system (functions, indicators and system) into C language.
It runs on DOS. In 2 years, out of about 400 trades, there have only been 4
discrepancies due to rounding problems between C and TS. Everything matches
up fine when I backtest over 6 years of data.
We have never "lost" a trade nor "gained" a trade.
One note - if your time feeds are not in gear, you may have realtime and
backtest variance. We experienced this with FutureSource last Monday when we
did not adjust the time offset for daylight savings (our fault).
Steve
|