Quote:
|
Originally Posted by Maji
Try this:
PHP Code:
double DailystartBal;
int CurrentTime = TimeHour(TimeCurrent());
if (CurrentTime == StartHour-1) {DailystartBal = AccountEquity();}
double DailyGrowth = ((AccountEquity() - DailystartBal)/DailystartBal);
|
No go. it still Resets the DailystartBal everytime AccountEquity() changes. returning a dailygrowth of 0.
Here is the entire function ...
PHP Code:
//ChartComment
void ChartComment() {
double DailystartBal;
int CurrentTime = TimeHour(TimeCurrent());
if (CurrentTime == StartHour-1) {DailystartBal = AccountBalance();}
double DailyGrowth = ((AccountBalance() - DailystartBal)/DailystartBal);
string sComment = "";
string sLine = "--------------------------------------------------------------";
string sNewLine = "\n";
sComment = sComment + sLine + sNewLine;
sComment = sComment + "- KURKA TRADER, My 2 ipps - "+ sNewLine;
sComment = sComment + sLine + sNewLine;
sComment = sComment + "Account Name : " + " KURKA FUND " + sNewLine;
sComment = sComment + "Current Balance : $ " + DoubleToStr(AccountBalance(),2) + sNewLine;
sComment = sComment + "Account Equity : $ " + DoubleToStr(AccountEquity(),2) + sNewLine;
sComment = sComment + "Account FreeMargin : $ " + DoubleToStr(AccountFreeMargin(),2) + sNewLine;
sComment = sComment + "Floating P&L : $ " + DoubleToStr(AccountProfit(),2) + sNewLine;
sComment = sComment + "Percentage Growth : % " + DoubleToStr(DailystartBal,4) + sNewLine;
sComment = sComment + sLine + sNewLine;
sComment = sComment + "OPEN POSITIONS : " + DoubleToStr(OrdersTotal(), 2)+ sNewLine;
sComment = sComment + sLine + sNewLine;
sComment = sComment + ": Type "+ ": Ticket " + " : Lots "+" : Swap "+" : Profit "+sNewLine;
int total = OrdersTotal();
for(int cnt=0;cnt<total;cnt++){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderType() == OP_BUY){
sComment = sComment + ": Buy :"+" # "+ DoubleToStr(OrderTicket( ),0)+" : "+DoubleToStr(OrderLots( ),2)+" : $ "+DoubleToStr(OrderSwap(),2)+" : $ "+DoubleToStr(OrderProfit(),2)+sNewLine;
}
if (OrderType() == OP_SELL){
sComment = sComment + ": Sell :"+" # "+ DoubleToStr(OrderTicket( ),0)+" : "+DoubleToStr(OrderLots( ),2)+" : $ "+DoubleToStr(OrderSwap(),2)+" : $ "+DoubleToStr(OrderProfit(),2)+sNewLine;
}
}
sComment = sComment + sLine + sNewLine;
sComment = sComment + "Upper Trigger : " + DoubleToStr(HighTrigger, 4) + " BID : " + DoubleToStr(Bid, 4)+ sNewLine;
sComment = sComment + "Lower Trigger : " + DoubleToStr(LowTrigger, 4) + " ASK : " + DoubleToStr(Ask, 4)+ sNewLine;
sComment = sComment + sLine + sNewLine;
Comment(sComment);
}
I like the chart comment for backtesting. it helps allot to see exactly what your EA is doing espically with multiple open positions. The ability to see the % growth would be great...