Please post the code that you have done so far and I am sure that someone will assist
I am trying to automate a relationship on EA on MT4.
If MACD becomes greater than 0.00000, and Moving Average A crosses (becomes greater) than Moving Average C, and then then buy at 0.1.
If Moving Average A crosses (becomes smaller) Moving Average B, and MACD becomes smaller than 0.000300, then take profit.
If Moving Average A crosses (becomes smaller) than Moving Average C, then stop loss.
Moving Average A: Period – 5 Shift – 0 MA Method – Exponential Apply to – Close
Moving Average B: Period – 7 Shift – 0 MA Method – Smoothed Apply to – Close
Moving Average C: Period – 75 Shift – 0 MA Method – Linear Weighted Apply to - Low
MACD: Fast EMA – 15 Slow EMA – 26 MACD SMA – 1 Apply to – Close
Anyone to assist
This is what I have done so far. Thank you for the response.
//---- input parameters extern int MA1=85; extern int MA2=75; extern int MA3=5; extern int MA4=7; extern int fastema=15; extern int lowema=26; extern int sl=15; extern int tp=15; /* extern int vltbars=10;//êîëè÷åñòâî áàðîâ äëÿ ïîäñ÷åòà âîëàòèëüíîñòè extern double deliter=1.5; //äåëèòåëü òåêóùåé âîëàòèëüíîñòè extern double stoppercent=0.50; // îò 1 äî 99 */ extern double Lots=0.1; int startb,starts; double stoplevel; int init() { stoplevel=MarketInfo(Symbol(),MODE_SPREAD)+MarketInfo(Symbol(),MODE_STOPLEVEL); } int start() {int buy,sell; buy=0;sell=0; for(int i=0;i<OrdersTotal();i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if(OrderType()==OP_BUY){buy=1;} if(OrderType()==OP_SELL){sell=1;} } double wma1 =iMA(NULL,0,MA1,0,MODE_LWMA,PRICE_LOW,1); double wma2 =iMA(NULL,0,MA2,0,MODE_LWMA,PRICE_LOW,1); double ema1 =iMA(NULL,0,MA3,0,MODE_EMA,PRICE_CLOSE,1); double ema2 =iMA(NULL,0,MA4,0,MODE_SMA,PRICE_CLOSE,1); double macdcurr =iMACD(NULL,0,lowema,lowema,1,PRICE_CLOSE,MODE_MAIN,1); double macdlast =iMACD(NULL,0,lowema,fastema,1,PRICE_CLOSE,MODE_MAIN,2); if(ema1<wma1 && ema1<wma2)startb=1; if(ema1>wma1 && ema1>wma2)starts=1; if(ema1>wma1 && ema1>wma2 && startb==1 && (macdcurr>0 || macdcurr>macdlast) && buy==0) { Print("BUY Bid: "+Bid+" sl: "+sl+" TakeProfit: "+tp); OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Ask-sl*Point,Ask+tp*Point,"FORTRADER.RU",0,0,Red); startb=0; } if(ema1<wma1 && ema1<wma2 && starts==1 && (macdcurr<0 || macdcurr<macdlast)&& sell==0) { Print("SELL Bid: "+Bid+" sl: "+sl+" TakeProfit: "+tp); OrderSend(Symbol(),OP_SELL,0.1,Bid,3,Bid+sl*Point,Bid-tp*Point,"FORTRADER.RU",0,0,Red); starts=0; } return(0); }
What you have done so far is copied and pasted somebody else's code and added 2 lines that don't do anything
extern int MA4=7; //Added Extern double ema2 =iMA(NULL,0,MA4,0,MODE_SMA,PRICE_CLOSE,1); //Added line,an SMA variable called ema2!! then not used
http://forex.forumup.it/post-11041-forex.html
Please do not copy other people's code and pretend that you have coded it
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to automate a relationship on EA on MT4.
If MACD becomes greater than 0.00000, and Moving Average A crosses (becomes greater) than Moving Average C, and then then buy at 0.1.
If Moving Average A crosses (becomes smaller) Moving Average B, and MACD becomes smaller than 0.000300, then take profit.
If Moving Average A crosses (becomes smaller) than Moving Average C, then stop loss.
Moving Average A: Period – 5 Shift – 0 MA Method – Exponential Apply to – Close
Moving Average B: Period – 7 Shift – 0 MA Method – Smoothed Apply to – Close
Moving Average C: Period – 75 Shift – 0 MA Method – Linear Weighted Apply to - Low
MACD: Fast EMA – 15 Slow EMA – 26 MACD SMA – 1 Apply to – Close
Anyone to assist