This script identifies Elliott waves and projects Fibonacci levels.
Initialize the variables. int lotSize = 1; Lot size. stopLoss int = 100; stoploss. int takeProfit = 200; Presumed profit.
Make sure the market is open. if (MarketInfo("EURUSD", MODE_BID) != 0) {
Get the close price of the previous bar. closing doublePrice = iClose (SymbolInfoPeriod(Symbol()));
Get Fibonacci levels. double fibonacciLevels[] = {0.236, 0.382, 0.618, 0.764};
Identify the current wave. int waveNumber = WaveCount(closePrice, fibonacciLevels);
If the current wave is an impulse wave, open a buy order. if (waveNumber == 1 || waveNumber == 3) { OrderSend(Symbol(), OP_BUY, lotSize, stopLoss, takeProfit, 0, 0, 0, 0, 0, <>); }
If the current wave is a correction wave, open a sell order. if (waveNumber == 2 || waveNumber == 4) { OrderSend(Symbol(), OP_SELL, lotSize, stopLoss, takeProfit, 0, 0, 0, 0, 0, <>); } }
Function to count Elliott waves. int WaveCount(double closePrice, double fibonacciLevels[]) {
Initialize the waveNumber variable. int waveNumber = 0;
Repeat the loop until the current wave is an impulse wave. while (wavenumber < 5) {
// Get the current Fibonacci level. double fibonacciLevel = fibonacciLevels[waveNumber]; // If the close price of the current bar is above the current Fibonacci level, the current wave is an impulse wave. if (closePrice > fibonacciLevel) { waveNumber++; } else { break; }
}
Return the current wave number. return waveNumber; }
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi,
I would like to test this EA- but, I 'm getting the warning bellow -
Warning - cannot be used for static allocated array -line 53 .
and other one related to - "return valur of Ordersend should be checked " where I resolved adding if --
if(OrderSend(request,result)){};
Doe anyone get the same erro ? or would be able to guide in how to solve this warning ?
Thanks in advance
This script identifies Elliott waves and projects Fibonacci levels.
Initialize the variables. int lotSize = 1; Lot size. stopLoss int = 100; stoploss. int takeProfit = 200; Presumed profit.
Make sure the market is open. if (MarketInfo("EURUSD", MODE_BID) != 0) {
Get the close price of the previous bar. closing doublePrice = iClose (SymbolInfoPeriod(Symbol()));
Get Fibonacci levels. double fibonacciLevels[] = {0.236, 0.382, 0.618, 0.764};
Identify the current wave. int waveNumber = WaveCount(closePrice, fibonacciLevels);
If the current wave is an impulse wave, open a buy order. if (waveNumber == 1 || waveNumber == 3) { OrderSend(Symbol(), OP_BUY, lotSize, stopLoss, takeProfit, 0, 0, 0, 0, 0, <>); }
If the current wave is a correction wave, open a sell order. if (waveNumber == 2 || waveNumber == 4) { OrderSend(Symbol(), OP_SELL, lotSize, stopLoss, takeProfit, 0, 0, 0, 0, 0, <>); } }
Function to count Elliott waves. int WaveCount(double closePrice, double fibonacciLevels[]) {
Initialize the waveNumber variable. int waveNumber = 0;
Repeat the loop until the current wave is an impulse wave. while (wavenumber < 5) {
// Get the current Fibonacci level. double fibonacciLevel = fibonacciLevels[waveNumber]; // If the close price of the current bar is above the current Fibonacci level, the current wave is an impulse wave. if (closePrice > fibonacciLevel) { waveNumber++; } else { break; }
}
Return the current wave number. return waveNumber; }