Made three-role improvement and reversal using EAつくーる!
Hello. This is Chobitto FX.
Well, as the title suggests,EA CreateI made a function for the Ichimoku Kinko Hyo that seems to exist but isn’t common, for its “Three Signals Bullish” enhancement and “Three Signals Bearish” reversal.
What is the Three Signals Bullish and Three Signals Bearish in the Ichimoku Kinko Hyo? You should askMr. Google.
Now, here is the function right away.
//--------------------------------------------------------------------------------------------------------+
//| Ichimoku Kinko Hyo “Three Signals Bullish” and “Three Signals Bearish” signal retrieval function
//| Process: Use Ichimoku Kinko Hyo to determine bullish signal (buy) or bearish signal (sell)
//| Arguments:
//| symbol: symbol name (currency pair, etc.)
//| period: time frame (PERIOD_H1, etc.)
//| shift : bar shift to retrieve (0 is latest, 1 is one bar before)
//| Return value:
//| 1: Three Signals Bullish signal (buy opportunity)
//| -1: Three Signals Bearish signal (sell opportunity)
//| 0: otherwise (no trade)
//--------------------------------------------------------------------------------------------------------+
int getIchimokuSignal(string symbol, int period, int shift) {
// Retrieve each line of Ichimoku Kinko Hyo
double tenkanSen = iIchimoku(symbol, period, 9, 26, 52, MODE_TENKANSEN, shift); // Conversion line
double kijunSen = iIchimoku(symbol, period, 9, 26, 52, MODE_KIJUNSEN, shift); // Base line
double chikouSpan = iIchimoku(symbol, period, 9, 26, 52, MODE_CHIKOUSPAN, shift); // Lagging span
double senkouSpanA = iIchimoku(symbol, period, 9, 26, 52, MODE_SENKOUSPANA, shift); // Leading span A
double senkouSpanB = iIchimoku(symbol, period, 9, 26, 52, MODE_SENKOUSPANB, shift); // Leading span B
double currentPrice = iClose(symbol, period, shift); // Current price (close price according to shift)
// Three Signals Bullish conditions (buy signal)
bool bullishCondition1 = tenkanSen > kijunSen; // Conversion line crosses above base line
bool bullishCondition2 = chikouSpan > iClose(symbol, period, shift + 26); // Lagging span crosses above price 26 periods ago
bool bullishCondition3 = currentPrice > senkouSpanA && currentPrice > senkouSpanB; // Current price breaks above cloud
// Three Signals Bearish conditions (sell signal)
bool bearishCondition1 = tenkanSen < kijunSen; // Conversion line crosses below base line
bool bearishCondition2 = chikouSpan < iClose(symbol, period, shift + 26); // Lagging span crosses below price 26 periods ago
bool bearishCondition3 = currentPrice < senkouSpanA && currentPrice < senkouSpanB; // Current price breaks below cloud
// Three Signals Bullish (buy signal)
if (bullishCondition1 && bullishCondition2 && bullishCondition3) {
return 1; // Buy opportunity
}
// Three Signals Bearish (sell signal)
else if (bearishCondition1 && bearishCondition2 && bearishCondition3) {
return -1; // Sell opportunity
}
// No signal
return 0;
}EA Create signifies that for a buy it is “signal = 1;”, and for a sell it is “signal = ‐1;”, so the return value follows that rule.
The usage is like this.
if(getIchimokuSignal(Symbol(), PERIOD_H1, 1) > 0) signal = 1;
For a sell, use below.
if(getIchimokuSignal(Symbol(), PERIOD_H1, 1) < 0) signal = -1;
That’s simple, isn’t it.
EA Create follows the rules, so you can also use the line below.
signal = getIchimokuSignal(Symbol(), PERIOD_H1, 1);
Well then.
File download is below.
× ![]()