I would like to use Mladen's "RSI of Advanced Kaufman - floating levels" as filter for my EA.
The EA should just be able to open a long trade when the slope goes up and color is changed to blue.
On the other hand it should be go short when it slopes down and the color is changed to red.
Could you please review my code, since it is not open / close a trade:
Loading the Indicator:
Code: Select all
enum enRsiTypes
{
rsi_rsi, // Regular RSI
rsi_wil, // Wilders' RSI
rsi_rap, // Rapid RSI
rsi_har, // Harris RSI
rsi_rsx, // RSX
rsi_cut // Cuttlers RSI
};
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
enum colorOn
{
clrOnSlope, // Color change on slope change
clrOnZero, // Color change on zero cross
clrOnlevel // Color change on levels cross
};
input string RSX_KAUFMAN="******************************";
extern ENUM_TIMEFRAMES TimeFrame=PERIOD_CURRENT; // Time frame to use
extern int RsiPeriod =14;
extern enRsiTypes RsiType=rsi_rsx; // Rsi type
extern int AmaPeriod = 10;
extern int AmaPrice = PRICE_CLOSE;
extern double FastEnd = 2;
extern double SlowEnd = 30;
extern double SmoothPower = 2;
extern bool JurikFDAdaptive = true;
extern int MinMaxPeriod = 35;
extern double LevelUp = 90;
extern double LevelDown = 10;
extern colorOn ColorChangeOn=clrOnSlope; // Color change on :
extern bool Interpolate=true;
Code: Select all
//+------------------------------------------------------------------+
//| RSI Kaufman Filter |
//+------------------------------------------------------------------+
int i;
double RSIfilter=0;
//1 Slope UP Signal
//2 Slope DOWN Signal
int BarShift = iBarShift(NULL,TimeFrame,Time[i]);
double rsiUp = iCustom(NULL,TimeFrame,"RSI_Kaufman",PERIOD_CURRENT,RsiPeriod,RsiType,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,MinMaxPeriod,LevelUp,LevelDown,ColorChangeOn,3,BarShift);
double rsiDn = iCustom(NULL,TimeFrame,"RSI_Kaufman",PERIOD_CURRENT,RsiPeriod,RsiType,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,MinMaxPeriod,LevelUp,LevelDown,ColorChangeOn,5,BarShift);
double rsiTrend = iCustom(NULL,TimeFrame,"RSI_Kaufman",PERIOD_CURRENT,RsiPeriod,RsiType,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,MinMaxPeriod,LevelUp,LevelDown,ColorChangeOn,7,BarShift);
if (rsiUp > rsiDn) RSIfilter = 1; // UP
if (rsiUp < rsiDn) RSIfilter = 2; // DOWN
Code: Select all
rsiUp_now -> BarShift
rsiUp_pre -> BarShift+1
if (rsiUp > rsiUp_pre && rsiUp_pre > rsiDn ) RSIfilter = 1; // UP
if (rsiDn < rsiDn_pre && rsiUp_pre < rsiDn) RSIfilter = 2; // DOWN
If it is RED -> Sell is OK
If it is GREEN -> Buy is OK
Thank you in advance for having a look.