Good evening! i was trying to fix a open signal inside my EA.
My Problem: I would like the MyMovingAverage to be a open signal so that when MyMovingAverage<Bid (which will be my Uptrend) gives a Uptrend Signal and my EA executes Buy Trades only each time the conditions are met. But it currently only executes one Trade and waits for the next signal.
i have been trying to slove this without success, i appricate any help Thanks!
voidOnTick()
{
//current chart, current period, 20 candels, no shift, simple, close pricedouble SlowMovingAverage = iMA(NULL,0,12,0,MODE_EMA,PRICE_CLOSE,0);
//current chart, current period, 20 candels, no shift, simple, close pricedouble LastSlowMovingAverage =iMA(NULL,0,12,0,MODE_EMA,PRICE_CLOSE,1);
//current chart, current period, 10 candels, no shift, simple, close pricedouble FastMovingAverage =iMA(NULL,0,26,0,MODE_EMA,PRICE_CLOSE,0);
//current chart, current period, 10 candels, no shift, simple, close pricedouble LastFastMovingAverage =iMA(NULL,0,26,0,MODE_EMA,PRICE_CLOSE,1);
////////////////////////////////Code for crossover ema/////////////////////////////////////////we claculate a string variable for the signalstring signal="";
///////FOR TREND//////////////calculate EMA 50double MyMovingAverage = iMA(NULL,0,50,20,MODE_EMA,PRICE_CLOSE,0);
//find out if the EMA is below the priceif (MyMovingAverage<Bid)
{
//set the signal to buy
signal="buy";
}
//if the EMA is above the Ask priveif (MyMovingAverage>Ask)
{
//set sell signal
signal="sell";
{
//define macddouble MACD=iMACD(_Symbol,_Period,12,26,9,PRICE_CLOSE,MODE_EMA,0);
if (MACD>0)
{
signal="sell mcd";
}
if (MACD<0)
{
signal="buy mcd";
}
}
}
if (MyMovingAverage<Bid)
//Chart output for Sell SignalComment ("UP");
if (MyMovingAverage>Ask)
//Chart output for Sell SignalComment ("DOWN");
if((MyMovingAverage<Bid)&&(MACD<0)&& (LastFastMovingAverage > LastSlowMovingAverage)&&(FastMovingAverage < SlowMovingAverage)&&(OrdersTotal() <3))
OrderSend(_Symbol,OP_BUY,0.01,Ask,3,0,Ask+150*_Point,NULL,0,0,Green);
return;
}
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.
Good evening!
i was trying to fix a open signal inside my EA.
My Problem:
I would like the MyMovingAverage to be a open signal so that when MyMovingAverage<Bid (which will be my Uptrend) gives a Uptrend Signal and my EA executes Buy Trades only each time the conditions are met. But it currently only executes one Trade and waits for the next signal.
i have been trying to slove this without success, i appricate any help Thanks!