I tried making an alligator with EA tools!
Hello. This is a little fx.
Well, as the title suggests,EA CreateI made an alligator that seems to exist but is hard to find.
What is an alligator? If you’re not sure,Mr. Googleis the one to ask.
Now, without further ado, here is the function.
// Alligator chance judging function
int getAlligatorSignal(string symbol, int period, int shift) {
// Settings for the alligator lines (jaws, teeth, lips) duration
int jawsPeriod = 13; // Jaw's period
int teethPeriod = 8; // Teeth's period
int lipsPeriod = 5; // Lips' period
int jawShift = 8; // Jaw's shift
int teethShift = 5; // Teeth's shift
int lipsShift = 3; // Lips' shift
// Get alligator lines
double jaw = iAlligator(symbol, period, jawsPeriod, jawShift, teethPeriod, teethShift, lipsPeriod, lipsShift, MODE_GATORJAW, shift);
double teeth = iAlligator(symbol, period, jawsPeriod, jawShift, teethPeriod, teethShift, lipsPeriod, lipsShift, MODE_GATORTEETH, shift);
double lips = iAlligator(symbol, period, jawsPeriod, jawShift, teethPeriod, teethShift, lipsPeriod, lipsShift, MODE_GATORLIPS, shift);
// Buy opportunity: Lips > Teeth > Jaw (all rising)
if (lips > teeth && teeth > jaw) {
return 1; // Buy opportunity
}
// Sell opportunity: Jaw > Teeth > Lips (all falling)
else if (jaw > teeth && teeth > lips) {
return -1; // Sell opportunity
}
// If neither, return 0 (no trade)
return 0;
}
EA Createuses when buying “signal = 1;”, when selling “signal = -1;” so the return value follows that rule.
The usage is like this.
if(getAlligatorSignal(Symbol(), PERIOD_H1, 1) > 0) signal = 1;
For selling, use below.
if(getAlligatorSignal(Symbol(), PERIOD_H1, 1) < 0) signal = -1;
Pretty simple, right.
EA Createfollows the rules, so the following may also be OK.
signal = getAlligatorSignal(Symbol(), PERIOD_H1, 1);
See you next time.
File download is from below.
× ![]()