MT4 EA drawdown per day

Feb 02, 2017 at 09:09
892浏览
3 Replies
会员从Jan 25, 2017开始   12帖子
Feb 02, 2017 at 09:09
Lets say I have an EA applied to an H1 chart.

How would I calculate the drawdown for that day?

Eg.

On Tick:
  If (Today is a New Day) then
    dailyDrawdown is 100.0
    thisMorningsWorth = netAssetValue()
  Else
    dailyDrawdown = netAssetValue() / thisMorningsWorth
  End

  If (dailyDrawdown < 0.95) then
    chillForToday()
  Else
    MakeThoseTrades()
  End

What's the best way to set this sort of thing up?
会员从Nov 21, 2011开始   1718帖子
Feb 02, 2017 at 17:01
Hi,

I calculate Daily_Profit.

Then
Make it %:
Daily_Profit / (Daily_Profit-AccountBalance() * 100

if Daily_Profit_Pourcentage > - x%... then trade.
会员从Jan 25, 2017开始   12帖子
Feb 03, 2017 at 07:51
Sketching this out, maybe something like:
--------------------
extern int defaultMaxOrders = 1;
extern double dailyLossLimit = 0.95;
extern double dailyProfitLimit = 1.05;

int today;
double dailyEquity;
double dailyProfit;
bool chillMode = false;

void newDay() {
  today = TimeDayOfWeek(TimeCurrent());
  dailyEquity = AccountEquity();
  chillMode = false;
}

void OnInit() {
  today = TimeDayOfWeek(TimeCurrent());
  dailyProfit = 1.0;
  dailyEquity = AccountEquity();
}

void OnTick() {
  if (today != TimeDayOfWeek(TimeCurrent())) {
    newDay();
  } else {
    if (AccountEquity() / dailyEquity > dailyProfitLimit || AccountEquity() / dailyEquity < dailyLossLimit) {
      chillMode = true;
      closeAll();
    }
  }
  if (openOrders(Symbol()) < defaultMaxOrders && chillMode == false) {
    if (isNewCandle()) { makeSomeGoodTrades(); }
  }
}
--------------------
?
会员从Nov 21, 2011开始   1718帖子
Feb 03, 2017 at 09:45
You can handle it.
Make backtest to check the behaviour is correct.
You can also print when Chillmode is true.
'No more trading... Loss <-5 or Profit >5'
登录 / 注册 to comment
You must be connected to Myfxbook in order to leave a comment
*商业用途和垃圾邮件将不被容忍,并可能导致账户终止。
提示:发布图片/YouTube网址会自动嵌入到您的帖子中!
提示:键入@符号,自动完成参与此讨论的用户名。