Re: Coding Help

181
Hi Pro-Coders,

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 for the filter:

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   
Maybe I should do something like?

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   
BUT actually I want to check if the color of the RSI Kaufman slope is RED or GREEN.
If it is RED -> Sell is OK
If it is GREEN -> Buy is OK

Thank you in advance for having a look.


Re: Coding Help

182
hobbytrader wrote: Wed Apr 26, 2017 6:21 pm Hi Pro-Coders,

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 for the filter:

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   
Maybe I should do something like?

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   
BUT actually I want to check if the color of the RSI Kaufman slope is RED or GREEN.
If it is RED -> Sell is OK
If it is GREEN -> Buy is OK

Thank you in advance for having a look.
hobbytrader

You can simply use the buffer 7 only
It has two values : +1 and -1. If it is +1, the trend is up. If it is -1, the trend is down. And if the current is not the same as previous, you have a trend change (ie: a signal)

Re: Coding Help

183
mladen wrote: Wed Apr 26, 2017 7:21 pm hobbytrader

You can simply use the buffer 7 only
It has two values : +1 and -1. If it is +1, the trend is up. If it is -1, the trend is down. And if the current is not the same as previous, you have a trend change (ie: a signal)
Hi Mladen,

thank you very much for your reply. You are a star!
BAM ! It's working :-)

Code: Select all

double rsiTrend = iCustom(NULL,TimeFrame,"RSI_Kaufman",PERIOD_CURRENT,RsiPeriod,RsiType,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,MinMaxPeriod,LevelUp,LevelDown,ColorChangeOn,7,BarShift);
   
   if (rsiTrend == 1) RSIfilter = 1;  // UP
   if (rsiTrend == -1) RSIfilter = -1; // DOWN
   

Re: Coding Help

184
hobbytrader wrote: Wed Apr 26, 2017 7:59 pm Hi Mladen,

thank you very much for your reply. You are a star!
BAM ! It's working :-)

Code: Select all

double rsiTrend = iCustom(NULL,TimeFrame,"RSI_Kaufman",PERIOD_CURRENT,RsiPeriod,RsiType,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,MinMaxPeriod,LevelUp,LevelDown,ColorChangeOn,7,BarShift);
   
   if (rsiTrend == 1) RSIfilter = 1;  // UP
   if (rsiTrend == -1) RSIfilter = -1; // DOWN
   
Happy trading :)

Re: Coding Help

185
Hi all.....I download Correl8b indicator and I try to do EA with this,but I can`t find values assigned.
I need to assign a value for every line ,and make the EA..for example.....
If Value 1 >Value 2 = SELL
If Value 2 >Value 1 = BUY
And..make it only for current pairs ,not for all pairs.If I apply on EUR USD ,show only values 1 and 2 for EUR USD...and same for GBP USD .. Value 1 and 2
Hope I make this post in right place...
Thanks.


Re: Coding Help

186
yamahaqs300 wrote: Wed Apr 26, 2017 9:10 pm Hi all.....I download Correl8b indicator and I try to do EA with this,but I can`t find values assigned.
I need to assign a value for every line ,and make the EA..for example.....
If Value 1 >Value 2 = SELL
If Value 2 >Value 1 = BUY

Hope I make this post in right place...
Thanks.
That depends on the parameters and the chosen currencies
You have to see the order of the currencies in the parameters and use that order to get the values from appropriator buffers (there are 8 buffers - one buffer for each currency in that indicator)

Re: Coding Help

187
Thank you for answer. Yes...correct ,but I want to "see" the values for every line . For example,when I keep the mouse over one line...to appear Value 1 ,Value 2....etc.
Is hard for me to find the values for every line.
I have no idea about Metaeditor language programming.... :(

Re: Coding Help

188
yamahaqs300 wrote: Thu Apr 27, 2017 12:09 am Thank you for answer. Yes...correct ,but I want to "see" the values for every line . For example,when I keep the mouse over one line...to appear Value 1 ,Value 2....etc.
Is hard for me to find the values for every line.
I have no idea about Metaeditor language programming.... :(
In iCustom() call the last two parameters are
- buffer number
- index

Just use the desired buffer number in the penultimate parameter of your iCustom() call

CodeRe: Coding Help

189
Hey,
i want to change line starting point. from right to left, detail in ss.


void SetUpPriceLabel(string Name,color Color,double price)
{
ObjectDelete(Name);
ObjectCreate(Name,OBJ_TREND,0,Time[0],price,Time[0]+Period()*(1),price);
ObjectSet(Name,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet(Name,OBJPROP_COLOR,Color);
ObjectSet(Name,OBJPROP_WIDTH,1);
ObjectSet(Name,OBJPROP_STYLE,0);
ObjectSet(Name,OBJPROP_RAY,false);

ObjectSet(Name,OBJPROP_TIME1,Time[0]+Period()*(1000));
ObjectSet(Name,OBJPROP_PRICE1,price); /* double price */
Attachments

Re: Coding Help

190
smok wrote: Thu Apr 27, 2017 3:38 am Hey,
i want to change line starting point. from right to left, detail in ss.


void SetUpPriceLabel(string Name,color Color,double price)
{
ObjectDelete(Name);
ObjectCreate(Name,OBJ_TREND,0,Time[0],price,Time[0]+Period()*(1),price);
ObjectSet(Name,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet(Name,OBJPROP_COLOR,Color);
ObjectSet(Name,OBJPROP_WIDTH,1);
ObjectSet(Name,OBJPROP_STYLE,0);
ObjectSet(Name,OBJPROP_RAY,false);

ObjectSet(Name,OBJPROP_TIME1,Time[0]+Period()*(1000));
ObjectSet(Name,OBJPROP_PRICE1,price); /* double price */
You are mixing trend lines and arrows
Create first two separate objects


Who is online

Users browsing this forum: No registered users and 11 guests