Using the CHIKOUSPAN in a EA

 

Hey there,


I wondering if somehow can give me clarity and/or how to use the CHIKOUSPAN in a ea. I using mainly the iIchimoku indicator in a EA I've made. The issue I'm having is when I try using the command of:

iIchimoku(NULL, PERIOD_M30, 9, 26, 52, MODE_CHIKOUSPAN, 0) < iIchimoku(NULL, PERIOD_M30, 9, 26, 52, MODE_KIJUNSEN, 0) //Ichimoku Kinko Hyo > Ichimoku Kinko Hyo


this code alone makes my EA either open sell orders only or sometimes no orders at all. Never buy orders. When used as an indicator instead, the buy and sell arrows appear, but the buy order arrow does not appear until hours later when the trade is long gone for execution. Take this line of code away and my Ea works fine, but not complete without this.

Simply put, I'm trying to make the ea open a trade when either the Chikouspan is below or above the Kijunsen.

I understand the  Chikouspan uses the past 26 bars for average price, but unclear wheteher or not the two can be used this way as an ea based on these errors I see. The log doesn't report any issues.

If this is possible can you tell me how to make this command work and maybe explain why the trades are doing this?

Thanks 

 
iIchimoku(NULL, PERIOD_M30, 9, 26, 52, MODE_CHIKOUSPAN, 0) < iIchimoku(NULL, PERIOD_M30, 9, 26, 52, MODE_KIJUNSEN, 0) //Ichimoku Kinko Hyo > Ichimoku Kinko Hyo

Have a look at the chart. Do you see any value for the chikou for the current bar?

I understand the  Chikouspan uses the past 26 bars for average price, 

Then you understand incorrectly. The chikou is just price shifted back 26 bars.

Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

 

Sorry, but I guessed I asked this question incorrectly. Even with the shift for value as so:

iIchimoku(NULL, PERIOD_H1, 9, 26, 52, MODE_CHIKOUSPAN, 19) < iOpen(NULL, PERIOD_H1, 1) //Ichimoku Kinko Hyo < Candlestick Open


The EA still does the same thing. What I'm asking is if the  Chikouspan can be used in a ea or based on how its calculated it will not work correctly or well with any command cross references to another indicator?

I'm trying to find out if this can be used or not in a EA or if its more for manual trades and observing charts? If can be used in a EA, can you give an example of a code using it?

 
Tuck99:

Sorry, but I guessed I asked this question incorrectly. Even with the shift for value as so:

iIchimoku(NULL, PERIOD_H1, 9, 26, 52, MODE_CHIKOUSPAN, 19) < iOpen(NULL, PERIOD_H1, 1) //Ichimoku Kinko Hyo < Candlestick Open


The EA still does the same thing. What I'm asking is if the  Chikouspan can be used in a ea or based on how its calculated it will not work correctly or well with any command cross references to another indicator?

I'm trying to find out if this can be used or not in a EA or if its more for manual trades and observing charts? If can be used in a EA, can you give an example of a code using it?

Before you posted

iIchimoku(NULL, PERIOD_M30, 9, 26, 52, MODE_CHIKOUSPAN, 0) < iIchimoku(NULL, PERIOD_M30, 9, 26, 52, MODE_KIJUNSEN, 0) //Ichimoku Kinko Hyo > Ichimoku Kinko Hyo

and I replied

Keith Watford:

Have a look at the chart. Do you see any value for the chikou for the current bar?

Now you post

iIchimoku(NULL, PERIOD_H1, 9, 26, 52, MODE_CHIKOUSPAN, 19) < iOpen(NULL, PERIOD_H1, 1) //Ichimoku Kinko Hyo < Candlestick Open

So what do you think that my reply will be this time?...............................

Have a look at the chart. Do you see any value for the chikou for the bar 19?

Reason: