欢迎访问 外汇EA下载与MT4/MT5自动交易资源 - 聚合外汇EA、黄金EA、量化交易工具与自动化交易实战内容。
登录 注册

又一个 Martingale EA (Just Another Martingale EA)

author emer | 38 人阅读 | 0 人评论 |
Mr. xlitang got me inspire again with his thread Promised EA system ..

So here I continue the martingale strategy development from the old code I have (see this thread 3060EA and back test help wanted )

Timeframe: H1
Pair: GBPUSD, USDCHF
Deposit: 10,000

First Buy trade condition:

Inserted Code
   if(MFI<=0      
      && MFID>50 
      && CountOrder.Buy()==0
      && Bid>ema50
      && Bid>ema20
      && Bid>Low[iLowest(NULL,0,MODE_LOW,3,0)]+100*Point
      )

First Sell trade condition:

Inserted Code
   if(MFI>=100       
      && MFID<50
      && CountOrder.Sell()==0
      && Bid>ema50
      && Bid<ema20 
      && Bid+100*Point<High[iHighest(NULL,0,MODE_HIGH,3,0)]
      )

MFI=Money Flow Index, H1, Bar[0]
MFID=Money Flow Index, Day, Bar[0]
ema... = exp moving average

When "first" trade was placed, trailing stop loss take over the rest.
if losing, open another trade to recoup the profit by certain offset.
this offset I use 2xATR (two times of Average True Range) -- about 20-60 pips depends on the market wilderness.

Inserted Code
double ATR=iATR(NULL,0,14,0);

The second, third, forth etc. orders have larger lot size and lower/higher than first opened trade, which is calculated by

Inserted Code
  
LotBuy=startlot*MathPow(1.4,CountOrder.Buy());
LotSell=startlot*MathPow(1.4,CountOrder.Sell());

The concept of trailing stop loss is the same as MPTM by SteveHopwood (I didn't copy but just think the same thing he did before link: http://www.stevehopwoodforex.com/php....php?f=21&t=64)

trigger1 is distance (points) to opened price/Stoploss when hit it will move the stoploss up/down (buy/sell relatively) by move1 points
Inserted Code
extern int     trigger1=150;
extern int     move1=30;

Try optimizing those two number can give wide varity of outcome. I never do that. Feel free to spend your CPU time on it.

Well, I don't have forward test because I just finish it hour ago before writing this thread.

My ultimate goal (for Martingale thing) is "100$ deposit and run with Martingale strategy, standard account, 0.01 lot start and on GBPUSD Pair"..... still i'm not there yet.

PS. Poor english, la me
Capture.PNG
Capture.PNG
Capture.PNG
Capture.PNG
Capture.PNG
Capture.PNG

原帖附件 (2)

🔐
请登录后参与评论
注册满12小时后评论,即可解锁附件下载
立即登录