EMA Filtered RSI Code
if xaverage(c,20) > xaverage(c,50) then begin if rsi(c,15) > 50 then buy 10000/c shares next bar market; end; if rsi(c,15) < 50 then sell next bar market;
DMI Experiment Updated
inputs:
BelowRed( 20 ),
AboveBlue( 20 ),
rsilev(50),
Length( 14 ) [
DisplayName = "Length",
ToolTip = "Enter the number of bars over which to calculate the DMI."],
ADXTrend( 25 ) [ DisplayName = "ADXTrend", ToolTip = "Average Directional Movement Index Trend. Enter the level of the ADX above which an alert is triggered."], Version(1);
variables:
ReturnValue( 0 ),
oDMIPlus( 0 ),
oDMIMinus( 0 ),
oDMI( 0 ),
oADX( 0 ),
oADXR( 0 ),
oVolty( 0 );
ReturnValue = DirMovement( H, L, C, Length, oDMIPlus, oDMIMinus, oDMI, oADX, oADXR,
oVolty );
{if oDMIPlus > oDMIMinus and oADX > 14 then buy 10000/c shares this bar close
else sell this bar close;}
if Version = 1 then Begin //RSI to buy and sell.
if rsi(c,14) > rsilev
then buy 10000/c shares this bar Close
else sell this bar close;
end;
if Version = 2 then begin //Red DMI to buy and sell.
if oDMIMinus < 30
then buy 10000/c shares this bar Close
else sell this bar close;
end;
if Version = 3 then begin //Both to enter. Either to sell.
if oDMIMinus < 30 and rsi(c,14) > rsilev
then buy 10000/c shares this bar Close
else sell this bar close;
end;
if Version = 4 then Begin //Both to enter. RSI to sell.
if oDMIMinus < 30 and rsi(c,14) > rsilev
then buy 10000/c shares this bar Close;
if rsi(c,14) < rsilev
then sell this bar close;
end;