Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Indicators

Optimize single Moving average trading - indicator for MetaTrader 4

Views:
31569
Rating:
(9)
Published:
2010.09.22 08:58
Updated:
2014.04.21 14:55
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance


This code is following the idea of MA Profit, except that it is using a single Moving Average instead of the cross moving average system.

Using only a single moving average speeds up optimization, it can check all moving averages between 10 and 1000 in nearly no time.

Trading with single moving average gives three signals. Usually it works with large moving averages like 150 or even 500 or more.

  1. The curve is below the candles - buy
  2. The curve is above the candles - sell
  3. the curve is horizontal and many times crossing the candles - close positions and wait

By switching the period everything is re-calculated, you can check if different time frames (minute, hour, day and so on) show the same signal. Usually a signal is stronger if displayed by by multiple time frames. Also you can switch to lower time frame in order to find an entry point into a long or short trade.

The indicator draws 4 kinds of triangles

  1. Red with thick border: short trade with win
  2. Red with thin border: short trade lost
  3. Green with thick border: Long trade in win
  4. Green with thin border: Long trade lost

If a new signal is available the indicator can display an alert or use voice output. In this case you need the speak.dll, for example from https://www.mql5.com/en/code/8621.

The indicator dispays the status and the number for good and wrong signals in its status line.

The optimization can be in two modes:

  1. Simulated trading. The best moving average is the one which gave the best profit
  2. Counting intersections between candles. The less time the curve and the candles hit each other the better the moving average is.

Parameters: (look source code also)

extern bool bOptimize=true; // True: Find the best single MA by optimizing (switch time frame to re-optimize)
extern bool bOptimizeIntersect=true; // True: optimize for minimum intersections, otherwise optimize for max profit
extern int PeriodMA=400; // If you do not want to optimize, you can define a period
extern int Method=0; // Method for MA 0 = Simple, 1 = Expotential, 2 = Smoothed, 3 = Linear weighted
extern bool DrawTringles=true; // Draws triangles for the simulated trading
extern int MinMA=5; // Minimum test for optimizing
extern int MaxMA=500; // Maximum test for optimizing
extern int StepMA=1; // Step during optimizion, 1 tests every MA, 10 tests every 10th etc.
extern int CountOptimize=300; // Number of candles for optimizing
extern int RepaintBars=3000; // Number of candles on which we draw triangles and calculate the win/loss
extern bool Alarm=true; // Make a visible alert on new signal
extern bool bSpeak=true; // Speak the alert with gspeak

Moving average trading gives some very good signal but also a lot of false signals. I am currently seeking more ideas of filtering the false signal in order to publish my moving average expert advisor.

Plese use at your own risk!

MaEnv_02B MaEnv_02B

Indicator MaEnv_02B will be helpful to BUY, SELL or stay out of the market.

QuickFib QuickFib

Draws a fibonacci study on the visible portion of your chart, and basic downtrend and uptrend lines. Shows the basic price action geometry.

EA_PSar_002B_v1 EA_PSar_002B_v1

EA designed on the idea of the indicator Nik_PSAR_2B (http://codebase.mql4.com/6934). EA works on the Symbol = "EURUSD" and Period = M1.

RSI-MA RSI-MA

This indicator is a combination of a classic RSI and even more classic MA indicators. I hope it will be more stable and with more Profit/Loss Ratio.