Optimize single Moving average trading

0
(0)
Tên:
Optimize single Moving average trading
Tác giả: bông hoa (2010.09.22 10:58)
Đã tải xuống: 4866
Tải xuống:
Optimize single Moving average trading 1
MAProfitSingle.mq4 (22.0 Kb) Xem
Optimize single Moving average trading 2

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 Và 1000 in nearly no time.

Trading with single moving average gives three signals. Usually it works with large moving averages like 150 hoặc thậm chí 500 Hoặc nhiều hơn.

  1. The curve is below the candles - mua
  2. The curve is above the candles - bán
  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 (phút, giờ, 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 http://codebase.mql4.com/5036.

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.

Thông số: (look source code also)

extern bool bOptimize=true; // ĐÚNG VẬY: Find the best single MA by optimizing (switch time frame to re-optimize)
extern bool bOptimizeIntersect=true; // ĐÚNG VẬY: 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!

3 bình luận Để gửi bình luận mới, Xin vui lòng đăng nhập hoặc đăng ký

This indicator has errors when attempting to compile it.

If you manage to fix it please post it in full code post.

 

15.12.2010 03:07 FXIA

  1. nếu như (thanh != cBars)
           newBar = true;
       else  
           newBar = false;
       cBars = Bars;

    This is unsafe. Once Bars reaches Maximum Bars On Chart, the indicator stops working as Bars and cBars will not change.

    bool newBar = Time0 < Thời gian[0]; Time0 = Time[0];

  2. The code checking for a symbol/TF change is unnecessary. When that occurs you'll get a deInit() init() cycle.

  3. Hard coded array size but never checked if exceeded
    gTradeID++;
       ArrayResize(gTradeOpen,gTradeID+1);
       ArrayResize(gTradeMin,gTradeID+1);
       ArrayResize(gTradeMax,gTradeID+1);
       ArrayResize(gTradeCmd,gTradeID+1);
       ArrayResize(gTradeStart,gTradeID+1);
       ArrayResize(gTradeEnd,gTradeID+1);
    gTradeOpen[gTradeID] = price;
    ...
24.09.2010 17:40 WHRoeder

1. Bộ lọc thời gian 2. Daily average range

Bài đăng này hữu ích như thế nào?

Bấm vào một ngôi sao để đánh giá nó!

Đánh giá trung bình 0 / 5. Số phiếu bầu: 0

Không có phiếu bầu cho đến nay! Hãy là người đầu tiên đánh giá bài viết này.

Chúng tôi xin lỗi vì bài đăng này không hữu ích cho bạn!

Hãy để chúng tôi cải thiện bài đăng này!

Hãy cho chúng tôi biết cách chúng tôi có thể cải thiện bài đăng này?



Tác giả: Nhóm ngoại hối Wiki
Chúng tôi là một nhóm gồm các Nhà giao dịch ngoại hối giàu kinh nghiệm [2000-2023] những người cống hiến để sống cuộc sống theo cách riêng của chúng ta. Mục tiêu chính của chúng tôi là đạt được sự độc lập và tự do về tài chính, và chúng tôi đã theo đuổi việc tự học và có được nhiều kinh nghiệm trong thị trường ngoại hối như là phương tiện của chúng tôi để đạt được lối sống bền vững.