MT4 EA drawdown per day

Feb 02, 2017 at 09:09
884 개의 뷰
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
*상업적 사용 및 스팸은 허용되지 않으며 계정이 해지될 수 있습니다.
팁: 이미지/유튜브 URL을 게시하면 게시물에 자동으로 삽입됩니다!
팁: @기호를 입력하여 이 토론에 참여하는 사용자 이름을 자동으로 완성합니다.