# Ichimoku

20

Hi,

I am creating this EA, will open an order when the two lines cross SenkouSpan A and SenkouSpan B. The problem is that it does not open when I cross 26 times forward. It opens the position when the crossing is above or below the y-axis of the current price. place the code maybe someone can help me please. Thank you in advance

```
double ichi3=iIchimoku(Symbol(),0,TenkanSen,KijunSen,ChikouSpanB,MODE_SENKOUSPANA,0);  // I tried -26 int shift without any tangible result ...
double ichi4=iIchimoku(Symbol(),0,TenkanSen,KijunSen,ChikouSpanB,MODE_SENKOUSPANB,0);  // I tried -26 int shift without any tangible result ...

if (Posizioni()==0   && ichi3>ichi4  && NewBar()  ) {

}

if (Posizioni()==0   && ichi3<ichi4  && NewBar()  ) {

}```
20

I'm trying everything but I just can not solve. network not found anything useful on this topic in particular. I really need help please. Thank you

48598

southraming80:

I'm trying everything but I just can not solve. network not found anything useful on this topic in particular. I really need help please. Thank you

Have you tried:

``` double ichi3=iIchimoku(Symbol(),0,TenkanSen,KijunSen,ChikouSpanB,MODE_SENKOUSPANA,26);  // I tried -26 int shift without any tangible result ...
double ichi4=iIchimoku(Symbol(),0,TenkanSen,KijunSen,ChikouSpanB,MODE_SENKOUSPANB,26);  // I tried -26 int shift without any tangible result ...```
20

Roberto Jacobs:

Have you tried:

yes, 26 thus opens the position 26 times after crossing ... I should do 26 times before, but it does not work, is not accurate ... I tried -26 but clearly something is wrong, I think it's not just a matter of changing this number. At least I think so

48598

southraming80:

yes, 26 thus opens the position 26 times after crossing ... I should do 26 times before, but it does not work, is not accurate ... I tried -26 but clearly something is wrong, I think it's not just a matter of changing this number. At least I think so

Have you tried:

```
//-- in fact code for Ichimoku been made very easy by MQL4 and MQL5

double ichi3=iIchimoku(Symbol(),0,9,26,52,MODE_SENKOUSPANA,0); // should function properly
double ichi4=iIchimoku(Symbol(),0,9,26,52,MODE_SENKOUSPANB,0); // should function properly```
20

Roberto Jacobs:

Have you tried:

yes man, default setting  tried, no  setting problem.
i need  open position when senkou span a and b crossing  up or down 26 period forward.

thanks for help,  but it' not be solution :(

48598

southraming80:

yes man, default setting  tried, no  setting problem.
i need  open position when senkou span a and b crossing  up or down 26 period forward.

thanks for help,  but it' not be solution :(

I see..You can try:

if price_close > ichi4 // buy

if price_close < ichi4 // sell

16058

southraming80: will open an order when the two lines cross SenkouSpan A and SenkouSpan B. Th
`&& ichi3>ichi4  &&`
That code does not check for a cross. Just one above the other.
```double ichi3Cur=iIchimoku(Symbol(),0,TenkanSen,KijunSen,ChikouSpanB,MODE_SENKOUSPANA,26);
double ichi4Cur=iIchimoku(Symbol(),0,TenkanSen,KijunSen,ChikouSpanB,MODE_SENKOUSPANB,26);
double ichi3Pre=iIchimoku(Symbol(),0,TenkanSen,KijunSen,ChikouSpanB,MODE_SENKOUSPANA,27);
double ichi4Pre=iIchimoku(Symbol(),0,TenkanSen,KijunSen,ChikouSpanB,MODE_SENKOUSPANB,27);
bool  isUp = ichi3Cur > ichi4Cur;
bool wasUp = ichi3Pre > ichi4Pre;
bool cross = isUp != wasUp;```
20

whroeder1:
That code does not check for a cross. Just one above the other.

Thank you!
Now it worked with periods -26 and -27 for cross!!!

Really Thank you!

20

Roberto Jacobs:

I see..You can try:

if price_close > ichi4 // buy

if price_close < ichi4 // sell

roberto Thank you.