OrderClose error on three EMA crosses EA - page 3

 
RaptorUK:

You still haven't read the documentation for iLow() . . . the first parameter is a string and is the Symbol, what symbol is PB[0] ? PB[] is a double not a string . . . do you understand why this is never going to work ?

This is where your missing bracket is . . . all you need to do is count them . . .


thank you so mutch,

but I've wrong to paste the script version,

you catch the error,

I was trying to use another way like the arraysort instead of use ilow and ihigh directly,

all this for a parenthesis .

 
giuseppeloddo:

after this simple EMA cross indicator and EA, I'm trying to translate in MQL4a type of Dorsey indicator,

I've trouble to use the iLow for select the low and lowest value of an array of a variable PB values.

Maybe you are running the EA with the wrong averages. No matter how much you mess about with moving averages, adding indicators or restricting entry it is hard not to end up buying at the top or selling near the bottom.

// Checks to see if we should trade
void fastEMATrade() {
        if (countOfFastEMATrades() < maxTrades && lastTrade != Time[0]) {
                double ema10 = iMA(Symbol(), 0, MA_Fast_Period, 0, MODE_EMA, PRICE_CLOSE, 1);
                double ema25 = iMA(Symbol(), 0, MA_Mid_Period, 0, MODE_EMA, PRICE_CLOSE, 1);
                double ema50 = iMA(Symbol(), 0, MA_Slow_Period, 0, MODE_EMA, PRICE_CLOSE, 1);
                double d_RSI = iRSI(Symbol(), 0, RSI_Period, PRICE_CLOSE, 1);

                if (ema10 < ema25 && ema25 < ema50 && d_RSI > RSI_Sell_Restrict) {
                        if(Distance_OK(
                                Points_Bars,
                                Points_Period,
                                Points_Restrict / gd_One_Pip_Rate,
                                false
                        )) {
                                OrderSend(Symbol(), OP_SELL, lotSize, Bid,3,0,0,"3 EMA RSI & Price Entry Restrict Sell ", magicNumber);
                                lastTrade = Time[0];
                                return;
                        }
                } else if (ema10 > ema25 && ema25 > ema50 && d_RSI < RSI_Buy_Restrict) {
                        if(Distance_OK(
                                Points_Bars,
                                Points_Period,
                                Points_Restrict / gd_One_Pip_Rate
                        )) {
                                OrderSend(Symbol(), OP_BUY, lotSize, Ask,3,0,0,"3 EMA RSI & Price Entry Restrict Buy", magicNumber);
                                lastTrade = Time[0];
                                return;
                        }
                }

        }
}
 

Lol... Nice job with the crayons... Rap...

Yes Giuseppe... I think you mean to use the series array Low[]

double Low[]

Series array that contains the lowest prices of each bar of the current chart.

instead of iLow()

double iLow( string symbol, int timeframe, int shift)
Returns Low value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.
For the current chart, the information about low prices is in the predefined array named Low[].

At least I think that's what you meant to use.... I'm just trying to figure out WHAT you are trying to do....LOL..

PipPip..Jimdandy
Reason: