Edit Your Comment
MT4 EA drawdown per day
Členom od Jan 25, 2017
12 príspevkov
Feb 02, 2017 at 09:09
Členom od Jan 25, 2017
12 príspevkov
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?
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?
Členom od Nov 21, 2011
1718 príspevkov
Feb 02, 2017 at 17:01
Členom od Nov 21, 2011
1718 príspevkov
Hi,
I calculate Daily_Profit.
Then
Make it %:
Daily_Profit / (Daily_Profit-AccountBalance() * 100
if Daily_Profit_Pourcentage > - x%... then trade.
I calculate Daily_Profit.
Then
Make it %:
Daily_Profit / (Daily_Profit-AccountBalance() * 100
if Daily_Profit_Pourcentage > - x%... then trade.
Členom od Jan 25, 2017
12 príspevkov
Feb 03, 2017 at 07:51
Členom od Jan 25, 2017
12 príspevkov
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(); }
}
}
--------------------
?
--------------------
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(); }
}
}
--------------------
?
Členom od Nov 21, 2011
1718 príspevkov
Feb 03, 2017 at 09:45
Členom od Nov 21, 2011
1718 príspevkov
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'
Make backtest to check the behaviour is correct.
You can also print when Chillmode is true.
'No more trading... Loss <-5 or Profit >5'
*Komerčné použitie a spam nebudú tolerované a môžu viesť k zrušeniu účtu.
Tip: Uverejnením adresy URL obrázku /služby YouTube sa automaticky vloží do vášho príspevku!
Tip: Zadajte znak @, aby ste automaticky vyplnili meno používateľa, ktorý sa zúčastňuje tejto diskusie.