need help in simple MA based EA!!

 
Hi all,
I have got a wonderful EA from this forum which works very gr8 on longer timeframe.. I am testing it on 1 hr timeframe..

its simply a EA which takes position when price crosses Exponential moving average (12) with a new candle opening..
it books partial profit (variable) in 5 parts.

Everything is working fine but I want this EA to work on SIMPLE moving average rather than exponential moving average..


Can someone please do this for me ??

I have tried changing the parameter settings--- MA mode from 1 to 0, but then orders are not at all executing. there are some anchors (I don't know for what reason?) but may be it needs MQL expert to solve the issue..


looking for the reply and feedback on this EA..
 
Would have to understand what you mean by "but then orders are not at all executing" and what it is you see that has you thinking its not workng properly. Otherwise all we know is that the code is doing what it was designed to do.
 

i think when i change MA mode from 1 to 0 for SMA, EA still works on EMA... and I want this EA to work on SMA..


so please help

 

Add this comment to the EA and you will see the internal value of the MAmode

   if (MAmode<0 || MAmode>3)
      MAmode=1;
      
   Comment("MA is using mode ",MAmode) ;
 
 
Ickyrus:

Add this comment to the EA and you will see the internal value of the MAmode


sorry to say dear but am not mql language savy.. dont know anything about programming..


if i add this comment as and where shown by you, will it work on SMA??


thanks for the help..

 

See what I am looking for is

1. EA buys on new candle opening after price cross SMA 12 and

sells when new candle open below SMA 12 .


2. sma parameter should be there so that it will be variable..

3. partial profit booking option should be there

4. once position is created candle close below/above SMA 12 will act as a stoploss and reverse position..

5. if tp is hit in the same candle where the long/short position is created new position should not create automatically by EA.

(attached EA do the same i.e. if short position is created @ 1.31500 and tp is 1.31400 and tp got hit in the same candle so EA opens anothe short position at 1.31400)

6. a single sound alert after trade/order execution.


if anyone have the same EA please paste it here or mql expert can write the same for mt4 in five min.. (its so easy for them i guess!!)

guys please help me


thank you

 
Ickyrus:

Add this comment to the EA and you will see the internal value of the MAmode

if (MAmode<0 || MAmode>3)
      MAmode=1;
      
   Comment("MA is using mode ",MAmode) ;


after adding this comment orders are not executing automatically.. no reaction from EA even after price crossing the MA 12 and new candle opened above/below . I have changed MA mode to 0 as well.

 

The line of code Just puts the words "MA is using mode 0" in the topleft hand corner of the chart you put the EA on.

The code line if (MAmode<0 || MAmode >3) is the only possible place that the internal value of MAmode could be changed to a different value so displaying it in the top Left hand corner lets you know that it using the SMA values

This line of code makes no changes to the EA operation, as I don't know why you think it is wrong. I'm off to bed now. Someone else will look at it later or I will when I get up.

One can also use the Comment("Things I want to know about") to display values that the EA is working with if placed in the code after the postion the values have been assigned that is after variable=something ;

 
ketan_one:

sorry to say dear but am not mql language savy.. dont know anything about programming..


if i add this comment as and where shown by you, will it work on SMA??


thanks for the help..


This a forum that is about helping people to learn programming MLQ or who need help with MLQ.

 
Hi guys, I need help to built an EA.

The EA should delete 2 pending orders after two orders are worked.

Who can help me?
thanks
Reason: