佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

楼主: mancai

FOREX EA 外汇智能交易专区

  [复制链接]
 楼主| 发表于 1-12-2008 04:50 PM | 显示全部楼层 |阅读模式
本帖最后由 mancai 于 2-4-2010 09:44 AM 编辑

大家可以在这里分享,讨论,研发EA
我会把手头上的EA一一分享出来,只是找不到不会expired的上载空间


我只會寫一些非常簡單的EA,寫教學的確會笑死人
不過因爲我的分享,換來大家對我的真誠,EA都是cari的網友教我寫的
特別感謝my life my way 兄和其他在EA上對我給予指導的網友

icustom EA 教學 part 1

EA,template, indicators 下載點 (sample而已,別拿來用,包輸的)
http://www.savefile.com/files/1912577

打開裏面的mancai_EA_V3.mq4后會看到很長的code


首先是EA的parameter input
extern string Remark1 = "Use M15 TF chart";
extern bool UseMagicNumber = true;
extern int MagicNumber = 12345;  (magic number,每一個pair都要放不一樣)
extern double TakeProfit = 10;   (take profit 多少 pips)
extern double OrderLot = 0.1;     (order的lot size)
extern int Slippage = 5;
extern int Spread = 0;
extern double StopLoss = 200.0; // in pips   (stop loss 多少 pips)
extern double TrailingStop = 20;                      (trailing stop 多少 pips)
//extern double MinimumAccountBalance = 50;



buy和sell的 variable和condition

bool OpenBuySignal()
{
   double rsi1 = iCustom(NULL, 0, "RSIs_mtf", 0, 14, 0, 0, 0, 2500, "a", "b", 0, 0);
   double rsi_shifted1 = iCustom(NULL, 0, "RSIs_mtf", 0, 14, 0, 1, 0, 2500, "a", "b", 0, 1);
   double macdValue1 = iCustom(NULL, 0, "MTF_MACD_inColor", 0, 5, 8, 9, 0, 3, 0);
   //double macdValue1_op_shifted = iCustom(NULL, 0, "MTF_MACD_inColor", 0, 5, 8, 9, 0, 3, 1);
   double macdValue1_norm = iCustom(NULL, 0, "MTF_MACD_inColor", 0, 5, 8, 9, 0, 0, 0);
   double macdValue1_shifted = iCustom(NULL, 0, "MTF_MACD_inColor", 0, 5, 8, 9, 0, 0, 1);
   double fxtrend1 = iCustom(NULL, 0, "Forex_Trend", 23, 0, 0);
   double fxtrend1_shifted = iCustom(NULL, 0, "Forex_Trend", 23, 0, 1);
   double flattr1 = iCustom(NULL, 0, "FLATTR",0, 5, 8, 9, 10000, 1, 0);
   double fractal1 = iCustom(NULL, 0, "FractalVolty_v1", 1, 1, 1, 0, 0);
   double macdx1_h4 = iCustom(NULL, 0, "#MTF_MACD X_H4", 5, 8, 0, 0);
         
   if (rsi_shifted1 < rsi1 && macdValue1 == 0 && macdValue1_norm > macdValue1_shifted && fxtrend1 < 0.2 && fxtrend1 > fxtrend1_shifted && flattr1 == 1 && fractal1 > 0.001 && macdx1_h4 == 0)
   {
      return (true);
   }else{
      return (false);
   }   
}

bool OpenSellSignal()
{   
   double rsi2 = iCustom(NULL, 0, "RSIs_mtf", 0, 14, 0, 0, 0, 2500, "a", "b", 0, 0);
   double rsi_shifted2 = iCustom(NULL, 0, "RSIs_mtf", 0, 14, 0, 1, 0, 2500, "a", "b", 0, 1);
   double macdValue2 = iCustom(NULL, 0, "MTF_MACD_inColor", 0, 5, 8, 9, 0, 2, 0);
   //double macdValue2_op_shifted = iCustom(NULL, 0, "MTF_MACD_inColor", 0, 5, 8, 9, 0, 2, 1);
   double macdValue2_norm = iCustom(NULL, 0, "MTF_MACD_inColor", 0, 5, 8, 9, 0, 0, 0);
   double macdValue2_shifted = iCustom(NULL, 0, "MTF_MACD_inColor", 0, 5, 8, 9, 0, 0, 1);
   double fxtrend2 = iCustom(NULL, 0, "Forex_Trend", 23, 0, 0);
   double fxtrend2_shifted = iCustom(NULL, 0, "Forex_Trend", 23, 0, 1);
   double flattr2 = iCustom(NULL, 0, "FLATTR", 0, 5, 8, 9, 10000, 0, 0);
   double fractal2 = iCustom(NULL, 0, "FractalVolty_v1", 1, 1, 1, 0, 0);
   double macdx2_h4 = iCustom(NULL, 0, "#MTF_MACD X_H4", 5, 8, 1, 0);
      
   if (rsi_shifted2 > rsi2 && macdValue2 == 0 && macdValue2_norm < macdValue2_shifted && fxtrend2 > -0.2 && fxtrend2_shifted > fxtrend2 && flattr2 == 1 && fractal2 > 0.001 && macdx2_h4 == 0)
   {
      return (true);
   }else{
      return (false);
   }
}



buy和sell的close order condition

bool CloseBuySignal()
{
  double macdValue2_m30 = iCustom(NULL, 0, "MTF_MACD_inColor", 30, 5, 8, 9, 0, 2, 0);
      
if (macdValue2_m30 == 0)
{
    return (true);
  }else{
      return (false);
  }   
}

bool CloseSellSignal()
{   
   double macdValue1_m30 = iCustom(NULL, 0, "MTF_MACD_inColor", 30, 5, 8, 9, 0, 3, 0);
      
   if (macdValue1_m30 == 0)
   {
      return (true);
   }else{
      return (false);
   }
}


[ 本帖最后由 mancai 于 19-12-2008 06:38 PM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 1-12-2008 04:56 PM | 显示全部楼层
icustom EA 教學 part 2

怎樣寫buy & sell的 variable 和 condition?


我選幾個sample:

flattr indicator buy variable

double flattr1 = iCustom(NULL, 0, "FLATTR",0, 5, 8, 9, 10000, 1, 0);

flattr indicator sell variable

double flattr1 = iCustom(NULL, 0, "FLATTR",0, 5, 8, 9, 10000, 0, 0);

第一個參數代表使用的currency symbol,NULL就是當前的currency symbol
第二個參數代表timeframe,0就是當前的timeframe
第三個參數代表custom indicator的名
第4和5是custom indicator的parameter,你可以從indicator的properties找到它有多少paramaters,parameter可以有很多個,所以這是應indicator而異。在這里0時indicator本身的當前timeframe,5是fast ema,8就是slow ema,9是macd MA, 10000是count bar。
最后第二個就是重點,這是注明你要讀取indicator的那一個value,一個custom indicator可以有8個buffer,所以說最多能有8個value可以選取來讀。value是從0至7。待會我會教如何找indicator的value。
最后一個就是選擇Bar,value 0就是當前的bar,即是最右邊那個,如果value是1的話就表示最右邊的第二個bar(shifted 1 bar)。

如何找indicator本身的的parameter呢?



double click你的indicator,去input那裏,有多少就放進去我highlight藍色的字裏面,它可以是數字,可以是true/false,也可以是一些remark,如果是remark可以用" "這個符號,裏面雖便填寫就可以了。

所以這個indicator的input parameter是0,5,8,9,10000。

如何找buy or sell的value?



建議一個一個attach進去chart裏看,因爲有些system幾個indicator mix在一個windows裏面,會很亂的。
然後用mouse指向你要寫得indicator,好像下面的圖,我要藍色買,紅色賣,黃色不做任何東西。


記住第一個是value = 0, 接下來是 1,2,3...  不是你所看到的一開始就是indicator 名字,然後直接2。
confirm value后就填在紫色的地方。

buy or sell的condition怎樣寫?

其實這個很個人的,比如我這樣寫

   if (rsi_shifted1 < rsi1 && macdValue1 == 0 && macdValue1_norm > macdValue1_shifted && fxtrend1 < 0.2 && fxtrend1 > fxtrend1_shifted && flattr1 == 1 && fractal1 > 0.001 && macdx1_h4 == 0)

&& 是 and
|| 是 or
< 是 小過
> 是 大過
== 是 等於

我這樣寫是要 rsi shifted一個bar的要小過現在的rsi 和 MTF macd == 0 (藍色bar時) 和 MTF macd 現在的value要大過已經shifted一個bar的MTF macd 和 forextrend要大過0.2 和 forextrend現在的value要大過forextrend shifted一個bar的 和
flattr藍色 和 fractall 要 大過0.001 和 macdx藍色

buy和sell的close order condition

bool CloseBuySignal()
{
  double macdValue2_m30 = iCustom(NULL, 0, "MTF_MACD_inColor", 30, 5, 8, 9, 0, 2, 0);
      
if (macdValue2_m30 == 0)
{
    return (true);
  }else{
      return (false);
  }   
}

我這樣寫是因爲要一旦MTF macd M30紅色時就立刻close order。

=================================================================================

其實大家可以把全部variable列出來后,然後直接寫buy sell condition
我分開寫,有些buy有了,sell又出現,其實可以不用再寫的,只是我怕會亂才隨便給一個variable名字分開來寫的。
那些什麽在double后的rsi_shifted,macd_value1什麽的,自己可以define,但condition一定要用一樣的名字。

写完了compile没有error就可以开始backtest看performance了,如果EA不能开order或不能跑,可以在tester strategy那边的journal看看有什么error。


希望大家看得明白,可以做些簡單的EA來玩玩,我的料只有那麽多而已
會更多時再update大家,還有,如有教錯請糾正我

[ 本帖最后由 mancai 于 3-12-2008 07:44 AM 编辑 ]
回复

使用道具 举报

 楼主| 发表于 1-12-2008 04:57 PM | 显示全部楼层
保留。。。。。。。。
回复

使用道具 举报

 楼主| 发表于 1-12-2008 04:58 PM | 显示全部楼层
保留。。。。。。。。
回复

使用道具 举报

 楼主| 发表于 1-12-2008 04:58 PM | 显示全部楼层


myFXOverEasy EA (名字很囂張的EA )


Time Frame:
M15 or H4
Date Added:
July 20, 2008

myFXOverEasy Forex expert advisor uses a FXOE-Combo custom indicator, which in its turn is a combination of four other custom MetaTrader 4 indicators: Slope, Trend, LRSI and AscTrend (if enabled via input parameters). myfxovereasy Expert Advisor based on FXoverEasy system Combo indicator by Markus (m.schmidt[et]emtec.com).

This Expert Advisor trades _against_ FXoverEasy system Combo indicator signals.
You can modify it as you wish, but, please, leave thXXXXXght notice intact.

What are the stop-loss and take-profit used by this EA?
It uses 110 pip stop-loss and 160 pip take-profit that can be easily modified via input parameters.

How often does it trade?
On 4-hour USD/CHF chart (the optimum settings) this EA will trade 8-9 times a month on average.

Requirements:
If you want to see indicators, copy this template to your "MT4 folder"/templates/

EA
http://www.autotradingfx.com/files/private/myfxovereasy.mq4

Template
http://www.autotradingfx.com/files/private/fxovereasy.tpl

Indicators
http://www.autotradingfx.com/files/private/FXOE-Juice.mq4
http://www.autotradingfx.com/files/private/FXOE-Asctrend.mq4
http://www.autotradingfx.com/files/private/FXOE-ITrend.mq4
http://www.autotradingfx.com/files/private/FXOE-ITrendHisto.mq4
http://www.autotradingfx.com/files/private/FXOE-Combo.mq4
http://www.autotradingfx.com/files/private/FXOE-LRSI.mq4
http://www.autotradingfx.com/files/private/FXOE-SHIChannel.mq4
http://www.autotradingfx.com/files/private/FXOE-SHISlope.mq4
http://www.autotradingfx.com/files/private/fxoe-lib.mqh


[ 本帖最后由 mancai 于 2-12-2008 11:45 PM 编辑 ]
回复

使用道具 举报

 楼主| 发表于 1-12-2008 04:58 PM | 显示全部楼层
保留。。。。。。。。
回复

使用道具 举报

Follow Us
 楼主| 发表于 1-12-2008 04:59 PM | 显示全部楼层
保留。。。。。。。。
回复

使用道具 举报

 楼主| 发表于 1-12-2008 04:59 PM | 显示全部楼层
保留。。。。。。。。
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 1-12-2008 05:00 PM | 显示全部楼层
请别按报告,因为EA需要分catagory,所以保留一些空间。
回复

使用道具 举报

发表于 1-12-2008 09:27 PM | 显示全部楼层
在这先顶....顶....鼎......
回复

使用道具 举报

发表于 1-12-2008 09:42 PM | 显示全部楼层
感谢你为华人贡献,敬你。。。。。。
回复

使用道具 举报

发表于 1-12-2008 09:52 PM | 显示全部楼层
回复

使用道具 举报

发表于 1-12-2008 11:36 PM | 显示全部楼层
原帖由 mancai 于 1-12-2008 10:58 PM 发表


好像是沒有SL的哦~floating到好像steinz那樣



忘了几时下载的。没用过。。。那时用martingale style EA烧户口后就开始对EA有恐惧感。。。
回复

使用道具 举报

发表于 2-12-2008 12:27 PM | 显示全部楼层
原帖由 mancai 于 1-12-2008 04:50 PM 发表
大家可以在这里分享,讨论,研发EA
我会把手头上的EA一一分享出来,只是找不到不会expired的上载空间

用geocities之类的free hosting应该不会expired,但是有bandwith limitation.
geocities是每小时4mb。。。
回复

使用道具 举报

发表于 2-12-2008 12:54 PM | 显示全部楼层
原帖由 lantern 于 1-12-2008 09:52 PM 发表
http://www.sendspace.com/file/dytas0

先来一个,外汇飞机师
http://forexautopilot.com/


http://www.sendspace.com/file/v2toou
这应该是去年的飞机师,里面有8个EA。
但是我试了8个没一个可以赚钱的,设定问题?
回复

使用道具 举报

发表于 2-12-2008 01:00 PM | 显示全部楼层
好贴!

等待楼主更新你们最近测试的好东西。暂时我只是玩到merdekarama罢了。

节约空间,就在这里问。请问我参rojak的话会不会破坏其他的ea?

[ 本帖最后由 gn02305657 于 2-12-2008 01:02 PM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

发表于 2-12-2008 01:22 PM | 显示全部楼层
mancai兄开的必是好贴
本人就比较少用EA啦
manual至少在亏钱时只可以怨自己
回复

使用道具 举报

发表于 2-12-2008 01:34 PM | 显示全部楼层
谢谢大大的分享,在下感谢不尽,希望有机会和你会一会面
回复

使用道具 举报

 楼主| 发表于 2-12-2008 01:40 PM | 显示全部楼层
原帖由 kai78 于 1-12-2008 09:27 PM 发表
在这先顶....顶....鼎......


呵呵,我没什么时间update我的帖,希望你们会体谅我

原帖由 easylink78 于 1-12-2008 09:42 PM 发表
感谢你为华人贡献,敬你。。。。。。


饮胜~~

原帖由 lantern 于 1-12-2008 11:36 PM 发表



忘了几时下载的。没用过。。。那时用martingale style EA烧户口后就开始对EA有恐惧感。。。


martingale都是属于暴力EA,我都不会去用它的

原帖由 gfish213 于 2-12-2008 12:27 PM 发表

用geocities之类的free hosting应该不会expired,但是有bandwith limitation.
geocities是每小时4mb。。。


bandwith 4M应该够吧?我想不会很多人下载的

原帖由 于 2-12-2008 12:54 PM 发表


http://www.sendspace.com/file/v2toou
这应该是去年的飞机师,里面有8个EA。
但是我试了8个没一个可以赚钱的,设定问题?


设定很重要,但如果是依backtest来set,可能设到没有lose,但只是在你backtest的period里面没有lose,有时觉得没什么意思。

原帖由 gn02305657 于 2-12-2008 01:00 PM 发表
好贴!

等待楼主更新你们最近测试的好东西。暂时我只是玩到merdekarama罢了。

节约空间,就在这里问。请问我参rojak的话会不会破坏其他的ea?


不会有问题的,EA只会refer该refer的indicator。

原帖由 mzhiying 于 2-12-2008 01:22 PM 发表
mancai兄开的必是好贴
本人就比较少用EA啦
manual至少在亏钱时只可以怨自己


所以自己写,输了也怨自己
回复

使用道具 举报

发表于 3-12-2008 12:47 AM | 显示全部楼层
多謝你的教學,目前我在研究CodersGuruFullCourse的教學檔
希望可以自己寫出一個會發出alert的indicator
希望不會太難
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 1-1-2026 07:04 PM , Processed in 0.198879 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表