Ekam power RSi - Tick

Vragen en suggesties over Vesticode

Moderator: Perry

Ekam power RSi - Tick

Berichtdoor willie » zo 21 nov 2004, 21:30

Dit is een variant van de ekam power rsi. Bij tick (PLOT 1 ,2,3,4 ) geeft dit een fout melding. Weet iemand hier een oplossing voor met hetzelfde resultaat.

(de functies zijn te vinden via de link)
Vr. Gr.

Willie
========




{http://www.tradestationworld.com/discussions/Topic.aspx?Topic_ID=13560

_rsi verandert in pRSI

I went through this thing in detail (took a while) but I've got a version
that does
long and short and is vastly simplified. Orc seems to love to use ambiguous
var names and overly complicated math.

Here is the code;
;}
Input: ?RSILength( 7 ),
Price( ( Open + Close ) / 2 ),
ThresholdLength( 50 ),
RSISmoothLength( 3 ),
RSISmoothType( 4 ),
ThresholdMultiple( 1.68 ),
ThresholdSlack( 15 );

Variables:RSIWAvg( 0 ),
lastRSIAtPivotLo( 0 ),
lastPriceAtPivotLo( 0 ),
lastRSIAtPivotHi( 0 ),
lastPriceAtPivotHi( 0 ),
pRSI( 0 ),
RSIAvg( 0 ),
LongThreshold( 0 ),
ShortThreshold( 0 );

pRSI = ?RSI( Price, RSILength );
RSIAvg ?= Average( pRSI, ThresholdLength );{ figure out long/short threshold }
LongThreshold = RSIAvg / ThresholdMultiple;
ShortThreshold = RSIAvg * ThresholdMultiple;

RSIWAvg ?= TypeAverage( pRSI, RSISmoothLength, RSISmoothType, 0 );


{ long signal }
If RSIWAvg[0] > RSIWAvg[1] AND
RSIWAvg[1] < RSIWAvg[2] AND
RSIWAvg[2] < RSIWAvg[3] AND
RSIWAvg[3] < RSIWAvg[4] Then
? Begin { last bar was an RSI pivot low }
? if RSIWAvg[1] < ( LongThreshold + ThresholdSlack ) 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 < pRSI Then ? { RSI ? was lower => divergence }
Begin
Plot1( Low - 2 * tick, "Pivot-sB" ) ?{ plot a "significant" buy signal };
End
else
? Begin
if RSIWAvg[1] < LongThreshold Then
Begin ? ? ? ?{ no divergence, but RSI very low, and so it's worth noting - plot a normal buy signal }
Plot2( Low - 2 * tick, "Pivot-B" );
? ?End;
End;
LastPriceAtPivotLo = Price;
LastRSIAtPivotLo ? = pRSI;
End;

If RSIWAvg[0] < RSIWAvg[1] AND
RSIWAvg[1] > RSIWAvg[2] AND
RSIWAvg[2] > RSIWAvg[3] AND
RSIWAvg[3] > RSIWAvg[4] Then
? Begin { last bar was an RSI pivot high }
? if RSIWAvg[1] < ( ShortThreshold - ThresholdSlack ) AND{ RSI was "High enough" - RSI high enough for a pivot high, look for divergence }
? ?Price > lastPriceAtPivotHi AND { price was lower in last RSI pivot high, but }
? ?lastRSIAtPivotHi > pRSI Then ? { RSI ? was high => divergence }
Begin
Plot3( High + 2 * tick, "Pivot-sS" ) ?{ plot a "significant" sell signal };
End
else
? Begin
if RSIWAvg[1] > ShortThreshold Then
Begin ? ? ? ?{ no divergence, but RSI very high, and so it's worth noting - plot a normal sell signal }
Plot4( High + 2 * tick, "Pivot-S" );
? ?End;
End;
LastPriceAtPivotLo = Price;
LastRSIAtPivotLo ? = pRSI;
End;





==========



(Edited by willie at 10:57 pm op 21,nov. 2004)
willie
 
Berichten: 53
Geregistreerd op: vr 10 okt 2003, 20:49

Ekam power RSi

Berichtdoor BarneyB » wo 24 nov 2004, 12:45

willie,
ik gebruik ekam's versie - die werkt:
(plot 3 en 4 instellen als HSL)

{***********************************************************************
Indicator..........: Power RSI Pivot by FEDSignal.com
Destination........: Counter-Trend System
Last Modified Date.: 06/26/2003
Type Signals.......: Only RSI Pivot
Interval Settings..: Tick Bar, Volume Bar, TimeBar.
Aplication.........: RadarScreen 7.XX, TradeStation 7.XX
*************************************************************************}


Input:
? ? ?Length(7),price((o+c)/2),mult(0.0005),
? ? ?DrawHLines(true);

{ drawing related variable inputs }
Input: longDiverColor(green), longRSIColor(darkgreen), longRevDiverColor(cyan);
Input: shortDiverColor(red), ?shortRSIColor(darkred), ?shortRevDiverColor(yellow);

var:
? ?k_15(15), k_50(50),
? ?RSIWAvg(0),
? ?lastRSIAtPivotLo(0),lastPriceAtPivotLo(0),lastLoAtPivotLo(0),
? ?lastRSIAtPivotHi(0),lastPriceAtPivotHi(0),lastHiAtPivotHi(0);

{ figure out long/short threshold }
var:
? ?idx(0), RSIAvg(0),
? ?longThreshold(0),shrtThreshold(0),
? ?xRSI(0);

var:
? ?alertTextID(-1);

if barnumber = 1 then begin
? alertTextID = Text_New(date,time,0,"RSI");
end;

xRSI = ?RSI(Price,Length);
RSIAvg ?= Average(xRSI,k_50);
longThreshold = 60 - (100-RSIAvg)/1.68;
shrtThreshold = 40 + (RSIAvg)/1.68;
RSIWAvg ?= WAverage(RSI(Price,Length),3);

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

? if ? ? ?RSIWAvg[1] < (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",longDiverColor);
? ? ? ? if Text_GetTime(alertTextID) <> time then begin
? ? ? ? ? ?text_setLocation(alertTextID, date, time, 0);
? ? ? ? ? ?alert("RSI diver long");
? ? ? ? end;
? end
? else if RSIWAvg[1] < longThreshold then begin
? ? ? ?{ no divergence, but RSI very low, and so it's worth noting }
? ? ? ? { plot a normal long signal }
? ? ?Plot1(L-L*mult,"long",longRSIColor);
? ? ?if Text_GetTime(alertTextID) <> time then begin
? ? ? ? text_setLocation(alertTextID, date, time, 0);
? ? ? ? alert("RSI long");
? ? ?end;
? end
? else if RSIWAvg[1] > (shrtThreshold - k_15) { RSI was "high enough" }
? ? ?{ a pivot low while RSI reading is high, look for rev divergence }
? ? ?and Price > lastPriceAtPivotLo ? ? { price was higher in last RSI pivot low, but }
? ? ?and lastRSIAtPivotLo < xRSI then ? { RSI was lower => rev divergence } begin
? ? ? ? Plot1(L-L*mult,"long",longRevDiverColor);
? ? ? ? if Text_GetTime(alertTextID) <> time then begin
? ? ? ? ? ?text_setLocation(alertTextID, date, time, 0);
? ? ? ? ? ?alert("RSI rev diver long");
? ? ? ?end;
? end;
? lastPriceAtPivotLo = Price;
? lastLoAtPivotLo ? ?= L;
? lastRSIAtPivotLo ? = xRSI;
end;

if DrawHLines and lastLoAtPivotLo <> 0 then begin
? plot3(lastLoAtPivotLo,"lastL@pivotL");
? if ? ? lastLoAtPivotLo <> lastLoAtPivotLo[1]
? ? ?and Text_GetTime(alertTextID) <> time then begin
? ? ? ? text_setLocation(alertTextID, date, time, 0);
? ? ? ? alert("RSI support");
? ? ?end;
end;

if DrawHLines and lastHiAtPivotHi <> 0 then begin
? plot4(lastHiAtPivotHi,"lastH@pivotH");
? if ? ? lastHiAtPivotHi <> lastHiAtPivotHi[1]
? ? ?and Text_GetTime(alertTextID) <> time then begin
? ? ? ? text_setLocation(alertTextID, date, time, 0);
? ? ? ? alert("RSI resistance");
? ? ?end;
end;

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

? if RSIWAvg[1] > (shrtThreshold - k_15) and { RSI was "high enough" }
? ? ?{ RSI high enough for a pivot high, look for divergence }
? ? ?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(H+H*mult,"short",shortDiverColor);
? ? ? ? if Text_GetTime(alertTextID) <> time then begin
? ? ? ? ? ?text_setLocation(alertTextID, date, time, 0);
? ? ? ? ? ?alert("RSI diver short");
? ? ? ? end;
? end
? else begin
? ? ?if RSIWAvg[1] > shrtThreshold then begin
? ? ? ?{ no divergence, but RSI very high, and so it's worth noting }
? ? ? ? { plot a normal short signal }
? ? ? ? Plot2(H+H*mult,"short",shortRSIColor);
? ? ? ? if Text_GetTime(alertTextID) <> time then begin
? ? ? ? ? ?text_setLocation(alertTextID, date, time, 0);
? ? ? ? ? ?alert("RSI short");
? ? ? ? end;
? ? ?end;
? end;
? if RSIWAvg[1] < (longThreshold + k_15) and { RSI was "low enough" }
? ? ?{ a pivot high while RSI reading is low, look for rev divergence }
? ? ?Price < lastPriceAtPivotHi and { price was lower in last RSI pivot high, but }
? ? ?lastRSIAtPivotHi > xRSI then ? { RSI ? was higher => rev divergence } begin
? ? ? ? Plot2(H+H*mult,"short",shortRevDiverColor);
? ? ? ? if Text_GetTime(alertTextID) <> time then begin
? ? ? ? ? ?text_setLocation(alertTextID, date, time, 0);
? ? ? ? ? ?alert("RSI rev diver short");
? ? ? ? end;
? end;
? lastPriceAtPivotHi = Price;
? lastHiAtPivotHi ? ?= H;
? lastRSIAtPivotHi ? = xRSI;
end;
BarneyB
 
Berichten: 17
Geregistreerd op: ma 20 jan 2003, 21:11


Keer terug naar Vesticode

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers en 2 gasten

cron