Universal MA Cross EA - page 81

 
mitch910:
How do you choose which time frame it trades on? Is it just the current one open? Thanks.

Yes whatever time frame chart you put it on.

 

help

Hi, Im new to trading and programming. thanks so much for this mq4. below are some problem i faced after trying to edit the universal ma cross ea parameter and testing it on a demo account.

only 2 ma used.

- i would like open only 1 trade when fastma cross slowma.

- exit trade when the next crossover and open trade in the reverse position at the same time. (i have no problem with stoploss and trailing loss for exiting).

- after exiting by stoploss or trailing loss, do not open any trade until the next crossover

- also i would like to add a trading time, so what number shd i put(start:20 and end:4? but look like it is not working) in if i would like to trade at only eur and us trading time? my timezone is GMT+0800.

thanks in advance to anyone that can teach me to input correctly. any other advice is also appreciated. =)

 

the time you can set by using 0 -24 as you say, all of the other things you want are available, you just have to locate the settings for each

 

MA Cross EA , with Snake inicator

mrtools:
No problem Fajar, any problems don't hesitate to let us know.

Hi Mrtools

I will post a screenshot my hand traded system, which is based on the attached indies "buy-sell".

The results are quite well but I would ike to have you look at the snake indi which I use with halfperiod 4 or 5. You may know that it is

following the bars quite fast but also does repaint the last bar.

If it could be arranged to do this to a smaller degree, it would be of great value for an EA.

Hope you can find a solution.

Best regards and keep on to your great help.

Thanks in advance

wolfsch

buysell20.zip[ATTACH=CONFIG]145387

Files:
 
wolfsch:
Hi Mrtools

I will post a screenshot my hand traded system, which is based on the attached indies "buy-sell".

The results are quite well but I would ike to have you look at the snake indi which I use with halfperiod 4 or 5. You may know that it is

following the bars quite fast but also does repaint the last bar.

If it could be arranged to do this to a smaller degree, it would be of great value for an EA.

Hope you can find a solution.

Best regards and keep on to your great help.

Thanks in advance

wolfsch

buysell20.zip[ATTACH=CONFIG]145387

Hi Wolfsch,

Need the source code(mt4) and not decompiled version of the indicator before I can do anything.

 

help understanding the code

hello

might be a dumb question, but where in the code does the code get its signal. i read :

BuyCondition = true;

TradeDirection = "UP";

CrossTime = iTime(NULL,TimeFrame,0);

but where are the UP referenced, how does it now it is and up signal?

sorry for coming across as a newb, but havent seen this style of coding before, it is brilliant in is simplicty and i want to learn.

Kenny

if(ConfirmedOnEntry==true)

{

if(CheckTime==iTime(NULL,TimeFrame,0)) return(0); else CheckTime = iTime(NULL,TimeFrame,0);

FastMACurrent = iMA(NULL,TimeFrame,FastMAPeriod,FastMAshift,FastMAType,FastMAPrice,1);

SlowMACurrent = iMA(NULL,TimeFrame,SlowMAPeriod,SlowMAshift,SlowMAType,SlowMAPrice,1);

}

else

{

FastMACurrent = iMA(NULL,TimeFrame,FastMAPeriod,FastMAshift,FastMAType,FastMAPrice,0);

SlowMACurrent = iMA(NULL,TimeFrame,SlowMAPeriod,SlowMAshift,SlowMAType,SlowMAPrice,0);

}

CrossDirection = subCrossDirection(FastMACurrent,SlowMACurrent);

//----------------------- CONDITION CHECK

if(ReverseCondition==false)

{

//----------------------- BUY CONDITION

if(CrossDirection=="UP")

{

BuyCondition = true;

TradeDirection = "UP";

CrossTime = iTime(NULL,TimeFrame,0);

}

//----------------------- SELL CONDITION

if(CrossDirection=="DOWN")

{

SellCondition = true;

TradeDirection = "DOWN";

CrossTime = iTime(NULL,TimeFrame,0);

}

}

 

Snake

mrtools:
Hi Wolfsch, Need the source code(mt4) and not decompiled version of the indicator before I can do anything.

Hi Mrtools,

sorry, I have only the Zip which I posted and dont know where to get the mt4.

Is there no possibility to decode it? I would appreciate your help.

Thanks Wolfsch

 

...

Might help : "snake" = centered TMA

Some more about it can be found at this thread : https://www.mql5.com/en/forum/181241

wolfsch:
Hi Mrtools,

sorry, I have only the Zip which I posted and dont know where to get the mt4.

Is there no possibility to decode it? I would appreciate your help.

Thanks Wolfsch
 

snake EA

mladen:
Might help : "snake" = centered TMA Some more about it can be found at this thread : https://www.mql5.com/en/forum/181241

Mrtools,

thanks for your help, unfortunately the TMA is not suitable to this. IT WILL BRING A LOT MORE FALSE SIGNALS:

Now my question : is there a possibility to get an EA running where the different MAs could be implemented from outside? This would be a great tool fr optimising.

Thanks in advance

Wolfsch

 

uni cross

firedave:
I try to make an EA for any Moving Average Cross strategy, try to make it universal. So please let me know should you have any suggestion to add to this EA.

Common Setting :

-----------------

StopLoss (default 100)

Set your Stop Loss. Use 0 (zero) if you don't like to use Stop Loss ( not recommended ).

TakeProfit (default 200)

Set your Take Profit. Use 0 (zero) if you like to use open target.

Trailing Stop Setting :

----------------------

ver.6 TrailingStopType (default 1)

Set trailing stop type. 1:will start trailing if profit in pips is greater / same with TrailingStop. 2:will start trailing as soon as trade in profit. (will add other type of trailing stop if suggested, latest suggestion is SafeZone trailing stop post #99 https://www.mql5.com/en/forum/general )

TrailingStop (default 40)

Set the Trailing Stop. Use 0 (zero) if you don't use trailing stop feature.

Moving Average Setting :

------------------------

FastMAPeriod (default 10)

Fast Moving Average Period.

FastMAType (default EMA / 1)

Fast Moving Average Type 0:SMA 1:EMA 2:SMMA 3:LWMA

FastMAPrice (default Close / 0)

Fast Moving Average Applied Price 0:Close 1:Open 2:High 3:Low 4:Median 5:Typical 6:Weighted

ver.7.2 FastMAshift (default 0)

Fast Moving Average Shift

SlowMAPeriod (default 80)

Slow Moving Average Period.

SlowMAType (default EMA / 1)

Slow Moving Average Type 0:SMA 1:EMA 2:SMMA 3:LWMA

SlowMAPrice (default Close / 0)

Slow Moving Average Applied Price 0:Close 1:Open 2:High 3:Low 4:Median 5:Typical 6:Weighted

ver.7.2 FastMAshift (default 0)

Slow Moving Average Shift

Minimum Cross Distance :

------------------------

ver.2 MinCrossDistance (default 0)

Set the pip distance between FastMA and SlowMA to be consider as a valid cross. Use 0 (zero) to disable this filter.

ver.7 MaxLookUp (default 1)

Set number of bar after the cross to keep checking on the entry condition in regards with the minimum distance between FastMA and SlowMA. Need MinCrosDistance > 0 to enable this feature. Use 0 (zero) to disable this feature.

Exit Setting :

-------------

StopAndReverse (default true)

If set to TRUE, will exit any trade and reverse position when signal change.

PureSAR (default false)

If set to TRUE, will use no Stop Loss - Take Profit - and Trailing Stop. This is always in play setting.

ver.7.2 ExitOnCross (default false)

If set to TRUE, will exit any trade if there is an opposite cross without consider any additional filter. So exit purely base on moving average cross.

Third MA Setting :

------------------

ver.5 UseThirdMA (default false)

If set to TRUE (and UseCounterTrend = FALSE), will only trade according to ThirdMA direction, above for BUY and below for SELL.

ver.5 UseCounterTrend (default false)

If set to TRUE will keep trade even if counter ThirdMA direction, but with different StopLoss and TakeProfit. Need UseThirdMA = TRUE to enable this feature.

ver.7 OnlyCounterTrend (default false)

If set to TRUE will set the EA only to trade counter trend trade, mean BUY if cross below ThirdMA and SELL if cross above ThirdMA. Need UseCounterTrend = TRUE to enable this feature.

ver.5 ThirdMAPeriod (defaul 100)

Third Moving Average Period.

ver.5 ThirdMAType (default EMA / 1)

Third Moving Average Type 0:SMA 1:EMA 2:SMMA 3:LWMA

ver.5 ThirdMAPrice (default Close / 0)

Third Moving Average Applied Price 0:Close 1:Open 2:High 3:Low 4:Median 5:Typical 6:Weighted

ver.7.2 ThridMAshift (default 0)

Third Moving Average Shift

ver.5 CTStopLoss (default 0)

Set your Stop Loss for CounterTrend trade. Use 0 (zero) if you don't like to use Stop Loss ( not recommended ).

ver.5 CTTakeProfit (default 0)

Set your Take Profit for CounterTrend trade. Use 0 (zero) if you like to use open target.

Pivot Filter Setting :

-------------------

ver.8.0 Use.Pivot.Filter (default false)

Set to true if you like to filter the trade, only BUY if the cross of Slow and Fast MA occur between S1 and S2 and only SELL if the cross of Slow and Fast MA occur between R1 and R2.

Order Setting :

--------------

ReverseCondition (default false)

Set TRUE to reverse the entry condition.

ver.3 ConfirmedOnEntry (default true)

If set to TRUE, will enter/exit trade on the next bar after the cross confirmed. If set to FALSE, will enter/exit trade as soon as there is a cross.

ver.4 OneEntryPerBar (default true)

If set to TRUE, will only trade once on one bar. If set to FALSE, will trade more than once on one bar if the entry condition is still valid, although still one trade at a time.

NumberOfTries (default 5)

Number of try if the order rejected by the system.

Slippage (default 5)

Slippage setting.

MagicNumber (default 1234)

Use to generate Magic Number. Change this number ONLY if you like to run the EA on same pair and same time frame but with different setting.

Multiple Open Trade Setting :

-----------------------------

ver.5 MaxOpenTrade (default 2)

Number of maximum open trade at one time. This setting is use when StopAndReverse / PureSAR = FALSE so the EA won't close the open order when there is an opposite signal, but rather it will open a new trade. Set the number of open trade allowed. If StopAndReverse / PureSAR = TRUE this setting will always = 1, mean one trade at a time.

ver.6 MinPriceDistance (default 5)

If multiple open trade enable (by set MaxOpenOrder>1 and OneEntryPerBar=FALSE) this number will determine the minimum distance between each trade on same direction.

Time Filter Setting :

-------------------

UseHourTrade (default false)

If set to TRUE, the EA only active on certain time.

StartHour (default 10)

Time when the EA start active (use with UseHourTrade = TRUE).

EndHour (default 11)

Time when the EA stop active (use with UseHourTrade = TRUE).

Lot and Money Management Setting :

------------------------------------

Lots (default 1)

Number of lot per trade.

MM (default false)

If set to TRUE, will use build in money management.

AccountIsMicro (default false)

If using Micro Account set this to TRUE.

Risk (default 10)

Use with MM = TRUE to set the risk per trade.

Cross Alert Setting :

--------------------

ver.5 EnableAlert (default true)

Will sound an alert when there is a moving average cross, cross UP or cross DOWN.

ver.5 SoundFilename (default "alert.wav")

The filename for the alert.

BackTest Setting :

------------------

PrintControl (default true)

Print some comment on backtesting.

Show_Settings (default true)

Show setting on the chart.

Let me know if you still got problem with the setting. Thank you to codersguru and pengie for several partial code. Hope this help

Journal :

-----------

version.6 :

- fixed ConfirmedOnEntry bug.

- add immediate trailing stop.

- add MinPriceDistance for multiple open trade.

version.7 :

- add MaxLookUp feature to keep checking on the entry after certain bar from the cross regarding the MinCrossDistance.

- add OnlyCounterTrend feature if using ThirdMA filter.

version.7.1 :

- fixed MinCrossDistance bug.

version.7.2 :

- fixed MinCrossDistance bug for ConfirmedOnEntry = FALSE.

- add MA shift parameter.

- add ExitOnCross feature.

version.7.3 :

- fixed on screen display COMMENT.

version.8.0 :

- added Pivot Filter.

version.8.1 :

- revised some code because Build 206 bugs.

Hi

I would like to know if you could put any ma in your EA f.i. the UNI_CROSS as attached. It containes 2 special MA namely the SNAKE and the T3 CLEAN, as attached. The Unicross shows a bit of repainting but anyway it gives good results on 1 H tf.

I would be glad if you can experiment with it.

Thanks Wolfsch

Files:
Reason: