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)