RSI - Indicator

Vragen en suggesties over handelssystemen en indicatoren

Moderator: Perry

RSI - Indicator

Berichtdoor JPR » vr 31 okt 2003, 23:51

PowerRSI Indicator


Input:
?Factor( 1 ),
? ? ?RSILength(7), SmoothLength( 50 ), price((o+c)/2),mult(0.0005),
? ? ?DrawHLines(false);

var:
? ?k_15(15),
? ?RSIWAvg(0),
? ?lastRSIAtPivotLo(0),lastPriceAtPivotLo(0),
? ?lastRSIAtPivotHi(0),lastPriceAtPivotHi(0),
idx(0), RSIAvg(0),
? ?longThreshold(0),shrtThreshold(0),
? ?xRSI(0);

If MTF( Factor ) Then
Begin
xRSI = ?_RSI( Factor, Price, RSILength );
RSIAvg ?= AverageMTF( Factor, xRSI, SmoothLength );
longThreshold = 60 - ( 100-RSIAvg ) / 1.68;
shrtThreshold = 40 + ( RSIAvg ) / 1.68;
RSIWAvg ?= WAverageMTF( Factor, xRSI, 3 );

{ drawing related variables }
var: lngDiverColor(green),lngRSIColor(darkgreen),lngRevDiverColor(cyan);
var: srtDiverColor(red), ?srtRSIColor(darkred), ?srtRevDiverColor(yellow);
var: HLLongID(-1), HLShortID(-1), HLLongPrice(0), HLShortPrice(0);

{ long signal }
if RSIWAvg > RSIWAvg[ Factor ] and
? RSIWAvg[ Factor ] < RSIWAvg[ 2 * Factor ] and
? RSIWAvg[ 2 * Factor ] < RSIWAvg[ 3 * Factor ] and
? RSIWAvg[ 3 * Factor ] < RSIWAvg[ 4 * Factor ] then begin { last bar was a RSI pivot low }

? if RSIWAvg[ Factor ] < (longThreshold + k_15) and { RSI was "low enough" }
? ? ?{ RSI low enough for a pivot low, look for divergence }
? ? ?Price < lastPriceAtPivotLo and { price was higher in last RSI pivot low, but }
? ? ?lastRSIAtPivotLo < xRSI then ? { RSI ? was lower => divergence } begin
? ? ? ? { plot a "significant" long signal }
? ? ? ? Plot1(L-L*mult,"long",lngDiverColor);
? ? ? ? if (DrawHLines) then
? ? ? ? ? ?HLLongID = eKamLine(date,time,Price,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?date,time,Price,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?false,false,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?lngDiverColor,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Tool_dotted);
? end
? else if RSIWAvg[ Factor ] < longThreshold then begin
? ? ? ?{ no divergence, but RSI very low, and so it's worth noting }
? ? ? ? { plot a normal long signal }
? ? ? ? Plot1(PriceMTF( Factor, Low )-PriceMTF( Factor, Low )*mult,"long",lngRSIColor);
? ? ? ? if (DrawHLines) then
? ? ? ? ? ?HLLongID = eKamLine(date,time,PriceMTF( Factor, Price ),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?date,time,PriceMTF( Factor, Price ),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?false,false,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?lngRSIColor,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Tool_dotted);
? end
? else if RSIWAvg[ Factor ] > (shrtThreshold - k_15) { RSI was "high enough" }
? ? ?{ a pivot low while RSI reading is high, look for rev divergence }
? ? ?and PriceMTF( Factor, Price ) > lastPriceAtPivotLo ? ? { price was higher in last RSI pivot low, but }
? ? ?and lastRSIAtPivotLo < xRSI then ? { RSI was lower => rev divergence } begin
? ? ? ? Plot1(PriceMTF( Factor, Low )-PriceMTF( Factor, Low )*mult,"long",lngRevDiverColor);
? ? ? ? if (DrawHLines) then
? ? ? ? ? ?HLLongID = eKamLine(date,time,PriceMTF( Factor, Price ),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?date,time,PriceMTF( Factor, Price ),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?false,false,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?lngRevDiverColor,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Tool_dotted);
? end;
? lastPriceAtPivotLo = PriceMTF( Factor, Price );
? lastRSIAtPivotLo ? = xRSI;
end;
if HLLongID <> -1 then
? TL_SetEnd( HLLongID, Date, Time, lastPriceAtPivotLo ) ;

{ short signal }
if RSIWAvg[ Factor ] > RSIWAvg and
? RSIWAvg[ Factor ] > RSIWAvg[ 2 * Factor ] and
? RSIWAvg[ 2 * Factor ] > RSIWAvg[ 3 * Factor ] and
? RSIWAvg[ 3 * Factor ] > RSIWAvg[ 4 * Factor ] then begin { last bar was a RSI pivot high }

? if RSIWAvg[ Factor ] > (shrtThreshold - k_15) and { RSI was "high enough" }
? ? ?{ RSI high enough for a pivot high, look for divergence }
? ? ?PriceMTF( Factor, Price ) > lastPriceAtPivotHi and { price was higher in last RSI pivot high, but }
? ? ?lastRSIAtPivotHi > xRSI then ? { RSI ? was higher => divergence } begin
? ? ? ? { plot a "significant" short signal }
? ? ?Plot2(PriceMTF( Factor, High )+PriceMTF( Factor, High )*mult,"short",srtDiverColor);
? end
? else begin
? ? ?if RSIWAvg[ Factor ] > shrtThreshold then begin
? ? ? ?{ no divergence, but RSI very high, and so it's worth noting }
? ? ? ? { plot a normal short signal }
? ? ?Plot2(PriceMTF( Factor, High )+PriceMTF( Factor, High )*mult,"short",srtRSIColor);
? ? ?end;
? end;
? if RSIWAvg[ Factor ] < (longThreshold + k_15) and { RSI was "low enough" }
? ? ?{ a pivot high while RSI reading is low, look for rev divergence }
? ? ?PriceMTF( Factor, Price ) < lastPriceAtPivotHi and { price was lower in last RSI pivot high, but }
? ? ?lastRSIAtPivotHi > xRSI then ? { RSI ? was higher => rev divergence } begin
? ? ?Plot2(PriceMTF( Factor, High )+PriceMTF( Factor, High )*mult,"short",srtRevDiverColor);
? end;
? lastPriceAtPivotHi = PriceMTF( Factor, Price );
? lastRSIAtPivotHi ? = xRSI;
end;

End;
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

RSI

Berichtdoor JPR » vr 31 okt 2003, 23:55

_RSI Function

inputs:
Factor( numericsimple ),
Price( numericseries ),
Length( numericsimple ) ; { this input assumed to be a constant >= 1 }

variables:
NetChgAvg( 0 ),
TotChgAvg( 0 ),
Change( 0 ),
SF( 1 / Length ), { smoothing factor }
ChgRatio( 0 ) ;

if CurrentBar = 1 then
begin
NetChgAvg = ( PriceMTF( Factor, Price ) - PriceMTF( Factor, Price )[ Length * Factor ] ) / Length ;
TotChgAvg = AverageMTF( Factor, AbsValue( PriceMTF( Factor, Price ) - PriceMTF( Factor, Price )[Factor] ), Length ) ;
end
else
begin
Change = PriceMTF( Factor, Price ) - PriceMTF( Factor, Price )[ Factor ] ;
NetChgAvg = NetChgAvg[Factor] + SF * ( Change - NetChgAvg[Factor] ) ;
TotChgAvg = TotChgAvg[ Factor ] + SF * ( AbsValue( Change ) - TotChgAvg[ Factor ] ) ;
end ;

if TotChgAvg <> 0 then
ChgRatio = NetChgAvg / TotChgAvg
else
ChgRatio = 0 ;

_RSI = 50 * ( ChgRatio + 1 ) ;
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

RSI

Berichtdoor JPR » vr 31 okt 2003, 23:56

PriceMTF Function


Inputs: Factor( numericsimple ), Price( numericseries );

If Factor > 1 Then
Begin
If Price = High Then
PriceMTF = Highest( High, Factor )
Else If Price = Low Then
PriceMTF = Lowest( Low, Factor )
Else If Price = Div( ( High + Low ), 2 ) Then
PriceMTF = Div( ( Highest( High, Factor ) + Lowest( Low, Factor ) ), 2 )
Else If Price = Range Then
PriceMTF = ( Highest( High, Factor ) - Lowest( Low, Factor ) )
Else If Price = Div( ( High + Low + Close ), 3 ) Then
PriceMTF = Div( ( Highest( High, Factor ) + Lowest( Low, Factor ) + Close ), 3 )
Else If Price = Div( ( High + Low + Open + Close ), 4 ) Then
PriceMTF = Div( ( Highest( High, Factor ) + Lowest( Low, Factor ) + Open[ Factor ] + Close ), 4 )
Else
PriceMTF = Average( Price, Factor );
End
Else
PriceMTF = Price;
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

RSI

Berichtdoor JPR » vr 31 okt 2003, 23:57

WAverageMTF Function


Inputs: Factor( numericsimple ), Price( numericseries ), Length( numericsimple );

Variables: Sum( 0 ), Weight( 0 ), Count( 0 ), Vector( 0 );

If Factor > 1 Then
Vector = PriceMTF( Factor, Price )
Else
Vector = Price;

Sum = 0;

If MTF( Factor ) Then
Begin
For Count = 0 to Length - 1
Begin
Sum = Sum + ( Length - Count ) * Vector[ Count * Factor ];
End;
Weight = ( Length + 1 ) * Length * 0.5;
If Weight > 0 Then
WAverageMTF = Div( Sum, Weight )
Else
WAverageMTF = WAverageMTF[1];
End
Else
WAverageMTF = WAverageMTF[1];
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

RSI

Berichtdoor JPR » vr 31 okt 2003, 23:58

MTF Function

Inputs: Factor( numericsimple );

If FracPortion( Div( CurrentBar, Factor ) ) = 0 Then
MTF = True
Else
MTF = False;
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

RSI

Berichtdoor JPR » za 01 nov 2003, 0:00

eKamLine Function

input:
? ? ?d1(NumericSeries),t1(NumericSeries),p1(NumericSimple),
? ? ?d2(NumericSeries),t2(NumericSeries),p2(NumericSimple),
? ? ?extLeft(TrueFalseSimple),extRight(TrueFalseSimple),
? ? ?color(NumericSimple),style(NumericSimple);

value1 = TL_New(d1, t2, p1,
? ? ? ? ? ? ? ?d1, t2, p2);
TL_SetExtLeft (value1,extLeft );
TL_SetExtRight(value1,extRight);
TL_SetColor ? (value1,color);
TL_SetStyle ? (value1,style);

eKamLine = value1;
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

RSI

Berichtdoor JPR » za 01 nov 2003, 0:01

Div Function

Inputs: Divend( numericsimple ), Divisor( numericsimple );

If Divend <> 0 AND Divisor <> 0 Then
Div = Divend / Divisor
Else
Div = 0;
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

RSI

Berichtdoor JPR » za 01 nov 2003, 0:06

Ik zie dat de Average MTF Function als een nieuw topic is gepost dat was niet de bedoeling ......... voor de rest veel plezier ermee ?:biggrin:
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

RSI

Berichtdoor Paul M » za 01 nov 2003, 16:18

Leuk en aardig, maar moet je wel zorgen dat het binnen Vestics werkt.

Paul.
Paul M
 
Berichten: 263
Geregistreerd op: vr 13 dec 2002, 23:21

RSI

Berichtdoor JPR » za 01 nov 2003, 16:40

Hallo Paul,

Ik heb Pierre afgelopen woensdag gesproken en volgens hem moet easylanguage van tradestadion gewoon in vestics werken....... vandaar mijn postings
Als je oplossingen hebt gevonden dan hoor ik het graag eventueel via ICQ of email. Ik zal Pierre een emailtje sturen.... Ik heb nog veel meer EL systemen en indicatoren maar ik stuit elke keer weer op die Functies in Vestics

Groeten

Paul R
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

RSI

Berichtdoor Paul M » za 01 nov 2003, 20:13

Hallo Paul,

Ik heb er ook een heleboel, maar door of nog ontbrekende functionaliteit of omdat Vestics net iets anders werkt, werken veel dingen vanuit Tradestation niet of nog niet in Vestics.

Paul.
Paul M
 
Berichten: 263
Geregistreerd op: vr 13 dec 2002, 23:21

RSI

Berichtdoor JPR » za 01 nov 2003, 21:22

Het is jammer, Pierre was heel stellig. Ik heb hem een mailtje gestuurd maar even afwachten. ?Ik begrijp dat jij voor sommige problemen wel een oplossing hebt gevonden. Ik zal dan ook zo nu en dan een intressant progje blijven posten. Wie weet dat jij er een oplossing voor hebt.

Groet,

Paul
JPR
 
Berichten: 85
Geregistreerd op: wo 03 jul 2002, 18:39

RSI

Berichtdoor rogier » wo 05 nov 2003, 11:44

Hallo,

Al geruime tijd ben ik een tevreden Vestics-gebruiker.
Het zelf programmeren van indicatoren is daarentegen een ander verhaal. Omdat ik toch regelmatig kant-en-klare programma's vind heb ik dat dan ook steeds voor me uit kunnen schuiven.

En dan nog ondervind ik problemen, zoals bij de StochRSI van Chande.Onderstaand programmaatje heb ik via de designer in zijn geheel ingebracht. Voor alle zekerheid toch nog even via editor gecontroleerd.

;Input: ?RSILen(13), LBLen(8), WAvgLen(5),Overbought(70),Oversold(30);

Var: ?RS(0),RSIL(0),RSIH(0),StochRSI(0);


RS=RSI(C,RSILen);
RSIL = Lowest(RS,LBLen);
RSIH = Highest(RS,LBLen);

StochRSI = (RS - RSIL)/(RSIH-RSIL);

Plot1(WAverage(StochRSI,WavgLen*100),"Stoch RSI");
Plot2(OverBought, "OverBought");
Plot3(OverSold, "OverSold");
end;

Wie schetst echter mijn verbazing als noch de indicator, noch de OB en OS lijnen te zien zijn.
Ik zie op dit forum zoveel programmeer-deskundigheid dat vast wel iemand mij kan vertellen waar de fout zit.
Alvast dank voor de hulp!
Mvg
Rogier
rogier
 
Berichten: 5
Geregistreerd op: di 03 dec 2002, 16:45

RSI

Berichtdoor Paul M » wo 05 nov 2003, 13:31

Input: ?RSILen(13), LBLen(8), WAvgLen(5),Overbought(70),Oversold(30);

Var: ?RS(0),RSIL(0),RSIH(0),StochRSI(0),xRSI(0);


RS=RSI(C,RSILen);
RSIL = Lowest(RS,LBLen);
RSIH = Highest(RS,LBLen);

StochRSI = (RS - RSIL)/(RSIH-RSIL);
xRSI=(WAverage(StochRSI,WavgLen))*100;
Plot1(xRSI,"Stoch RSI");
Plot2(OverBought, "OverBought");
Plot3(OverSold, "OverSold");
end;

Paul
Paul M
 
Berichten: 263
Geregistreerd op: vr 13 dec 2002, 23:21

RSI

Berichtdoor willie » wo 05 nov 2003, 15:14

Hallo,

Weet iemand ook hoe de lijn kleur van een indicator/systeem blijvend aanpast. Bovenstaande plot grijs, bij het wijzigen via plot eigenschappen springt het bij invoegen in een ander sjabloon de boel weer op grijs


Vr. gr.
willie
willie
 
Berichten: 53
Geregistreerd op: vr 10 okt 2003, 20:49

Volgende

Keer terug naar Handelssystemen + Indicatoren

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers en 7 gasten

cron