# Experts: Moving Average

Moderator
187252

The Expert Adviser Moving Average uses for trade signal generation one moving average.

Author: MetaQuotes Software Corp.

16319

16319

hi !
let me try it !
16319

Umm, a modeling quality of 25% is a bit too low.
16319

What are the stoploss/trailing stops? I can't find them anywhwere. Or does this close by % loss alone?

I tested it w/ 400.00, and got stopped on one with -\$3.10...which is nowhere near the 2% loss the thing is set at???
287

`if(losses>1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);`

Function is incorrect i.m.o.

`if(losses>1 && DecreaseFactor > losses) lot=NormalizeDouble(lot-lot*(losses/DecreaseFactor),1);`

should work better.

16319

My test results:

Strategy Tester Report
Moving Average
FXDD-MT4 Live Server (Build 220)

 Simbolo EURUSD (Euro vs. United States Dollar) Periodo 1 Ora (H1) 2007.07.02 01:00 - 2009.01.05 23:00 (2007.07.01 - 2009.01.06) Modello Ogni tick (il metodo precissimo sulla base di tutti gli intervalli di tempo minimi) Parametri Lots=0.1; MaximumRisk=0.02; DecreaseFactor=3; MovingPeriod=12; MovingShift=6; Barre sotto esame 10284 Ticks adoperati per il modello 3949236 Qualita' del modello 90.00% Errori di grafici 16 Deposito iniziale 5000.00 Profitto totale netto 1306.60 Profitto lordo 6988.01 Perdita lorda -5681.41 Fattore di profitto (profit factor) 1.23 Ricompensa attesa 3.19 Drawdown assoluto 259.11 Drawdown massimo 637.92 (9.26%) Drawdown relativo 9.26% (637.92) Operazioni totali 409 Posizioni al ribasso (vincite %) 229 (25.33%) Posizioni al rialzo (vincite %) 180 (27.78%) Operazioni con profitto (% del totale) 108 (26.41%) Operazioni in perdita (% del totale) 301 (73.59%) Il piu' grande operazione con profito 462.31 operazione in perdita -109.70 Media operazione con profito 64.70 operazione in perdita -18.88 Massimo vincite consecutive (profitto in denaro) 3 (11.96) perdite consecutive (perdita in denaro) 20 (-140.16) Massimale profitto consecutivo (numero delle vincite) 462.31 (1) perdita consecutiva (numero delle perdite) -463.86 (11) Media vincite consecutive 1 perdite consecutive 3
39

Simple but useful money management.

One comment: HistoryTotal() is the old name of that function and has been replaced by OrdersHistoryTotal.

So, in the Moving average.mq4 code you need to replace this sentence:

int ClosedOrders=HistoryTotal();

with this one

int ClosedOrders=OrdersHistoryTotal();

754

hi there,

is it possible to remove the auto-close features?

28

### see this scalping EA

16319

 Symbol EURUSDFXF (Euro vs US Dollar) Period 1 Hour (H1) 2007.03.30 17:01 - 2011.09.30 00:59 (2007.03.01 - 2011.06.20) Model Every tick (the most precise method based on all available least timeframes) Parameters Lots=0.1; MaximumRisk=0.02; DecreaseFactor=3; MovingPeriod=12; MovingShift=6; Bars in test 28117 Ticks modelled 34632921 Modelling quality 99.00% Mismatched charts errors 0 Initial deposit 10000.00 Total net profit 2786.20 Gross profit 71494.00 Gross loss -68707.80 Profit factor 1.04 Expected payoff 1.26 Absolute drawdown 600.60 Maximal drawdown 3375.60 (24.72%) Relative drawdown 24.72% (3375.60) Total trades 2205 Short positions (won %) 1102 (25.50%) Long positions (won %) 1103 (28.92%) Profit trades (% of total) 600 (27.21%) Loss trades (% of total) 1605 (72.79%) Largest profit trade 1155.60 loss trade -1006.80 Average profit trade 119.16 loss trade -42.81 Maximum consecutive wins (profit in money) 6 (353.40) consecutive losses (loss in money) 18 (-650.40) Maximal consecutive profit (count of wins) 1170.00 (4) consecutive loss (count of losses) -1280.80 (9) Average consecutive wins 1 consecutive losses 4