ChartIchimoku System: Chikou Span (Lagging Span) below or above price issue in MQL4

1
Hello Pro-Coders,

I wonder if someone could help me with my issue regarding Chikou Span (Lagging Span) below or above price.
I would like to use this as an indicator in my Ichimoku EA, but for some reasons the EA is just taking short trades,
but no long trades. When I leave the Chikou Span out the EA will take long and short trades.

Code: Select all

int ChikouIndicatorSignal()
  {
   int i;
   int ChikouSignal;
   int BarShift = iBarShift(NULL,TimeFrame,Time[i],0); // BarShift 0
    
// Validate Trend Direction
// Close Positions if Chikou touch Price:

double v_CHIKOUSPAN   = iIchimoku(NULL, 0, e_tenkan_sen, e_kijun_sen, e_senkou_span_b, MODE_CHIKOUSPAN, BarShift);

if (v_CHIKOUSPAN < Low[25])ChikouSignal =-1; //short
if (v_CHIKOUSPAN > High[25])ChikouSignal =1; //long

 return(ChikouSignal);
  }

When I use the TENKANSEN instead of "High" and "Low" the results are the same, just short trades no long trades.

Code: Select all

double v_TENKANSEN  = iIchimoku(NULL, 0, e_tenkan_sen, e_kijun_sen, e_senkou_span_b, MODE_TENKANSEN, BarShift);
double v_CHIKOUSPAN   = iIchimoku(NULL, 0, e_tenkan_sen, e_kijun_sen, e_senkou_span_b, MODE_CHIKOUSPAN, BarShift);

if (v_CHIKOUSPAN < v_TENKANSEN) ChikouSignal =-1;
if (v_CHIKOUSPAN > v_TENKANSEN) ChikouSignal =1;
Thank you in advance!


Re: Ichimoku System: Chikou Span (Lagging Span) below or above price issue in MQL4

2
Dear hobbytrader,

That is a funny issue, perhaps you can try a work around.

Here is what I suggest, simplify things by using the simplest form of chikou. That is the close of the 26 last bar, aka what the chikou normally is.
Next, using the barshift i+0, you will be comparing to a changing value while the bar is still closing to what you put the high/ low of 25th bar, so should work.
You can also just try with

Code: Select all

int BarShift =0;
if that is causing some issues with internal mt4.

Had an issue like this in another EA and flipping the buy and sell instruction seemed to solve my issues, don't remember why. So also worth a try if the above does not work.

Code: Select all

if (v_CHIKOUSPAN < Low[25])ChikouSignal =-1; //short
if (v_CHIKOUSPAN > High[25])ChikouSignal =1; //long
to

Code: Select all

if (v_CHIKOUSPAN > High[25])ChikouSignal =1; //long
if (v_CHIKOUSPAN < Low[25])ChikouSignal =-1; //short
Hope that helps ^_^

Re: Ichimoku System: Chikou Span (Lagging Span) below or above price issue in MQL4

3
Hi Tzamo,

thank you for you suggestion! Unfortunately the EA is still only doing short trades as soon as the CHIKOUSPAN is involved.
I even tried a simpler approach like below, but the result is the same, only short trades are executed.

Code: Select all

 int ChikouIndicatorSignal()
  {
 	int ChikouSignal;
 	int BarShift =0;
    
double v_TENKANSEN  = iIchimoku(NULL, 0, e_tenkan_sen, e_kijun_sen, e_senkou_span_b, MODE_TENKANSEN, BarShift);
double v_CHIKOUSPAN   = iIchimoku(NULL, 0, e_tenkan_sen, e_kijun_sen, e_senkou_span_b, MODE_CHIKOUSPAN, BarShift);

if (v_CHIKOUSPAN < v_TENKANSEN) ChikouSignal =-1;
if (v_CHIKOUSPAN > v_TENKANSEN) ChikouSignal =1;

  return(ChikouSignal);
  }



Who is online

Users browsing this forum: No registered users and 22 guests