• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 4:40am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 4:40am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Grid EA with Stop Loss and Total Basket Profit? 4 replies

Loss calculation does not match loss in backtesting MT4 - why? 6 replies

Where can I find this indicator "loss and repaint"? 2 replies

Where can I find a Breakeven Stop loss EA? 5 replies

How can I find These Values inorder to find resistance and support levels 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 2
Attachments: How can I find the total Profit/Loss of the day on MT4?
Exit Attachments
Tags: How can I find the total Profit/Loss of the day on MT4?
Cancel

How can I find the total Profit/Loss of the day on MT4?

  • Post #1
  • Quote
  • First Post: Jul 24, 2012 11:12am Jul 24, 2012 11:12am
  •  tigerbalm
  • | Joined Aug 2009 | Status: Member | 99 Posts
Hello, Any expert could give me the light of how I can sum up total loss/profit of certain day on MT4 ?

thanks
  • Post #2
  • Quote
  • Jul 24, 2012 7:02pm Jul 24, 2012 7:02pm
  •  hayseed
  • Joined Nov 2006 | Status: Member | 3,603 Posts
hey tiger..... it kinda depends on how you intend to select the day....

Inserted Code
 
extern string   date         = "2011.3.1 00:00";

in this case you would use OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)
to talley the results for that day......


or perhaps you might want a running total of every day.... this can be done via an indicator or a funtion of an ea..... the results would be sent using FILE_CSV|FILE_WRITE to your files folder in metatrader..... such as below......

other methods exist.....

in any event, the day must be included in your terminals order history.... sometimes the history will only contain the last few months.....h

//----

Inserted Code
 
Period: 2012.06.10 23:44 - 2012.07.18 13:48
StartBalance = 1288.25, Gain = 27.95%, MaxDrawDown = 0.01
Monthly Gain:
2012 June 13.68%
2012 July 12.56%
Daily Gain:
2012.06.11 0.58% 0.58%
2012.06.14 0.53% 1.11%
2012.06.15 1.36% 2.49%
2012.06.17 0.45% 2.96%
2012.06.18 0.87% 3.85%
2012.06.19 0.26% 4.12%
2012.06.20 0.87% 5.03%
2012.06.21 0.24% 5.29%
2012.06.22 2.23% 7.64%
2012.06.27 0.08% 7.72%
2012.06.28 4.06% 12.10%
2012.06.29 1.41% 13.68%
2012.07.02 0.44% 14.18%
2012.07.03 2.52% 17.06%
2012.07.04 1.39% 18.69%
2012.07.05 0.55% 19.33%
2012.07.06 1.03% 20.56%
2012.07.10 0.05% 20.62%
2012.07.12 1.58% 22.53%
2012.07.13 3.20% 26.45%
2012.07.16 0.08% 26.55%
2012.07.17 1.03% 27.85%
2012.07.18 0.07% 27.95%
to trade and code, keep both simple... no call to impress....h
 
 
  • Post #3
  • Quote
  • Jul 24, 2012 8:53pm Jul 24, 2012 8:53pm
  •  Xaphod
  • Joined Mar 2010 | Status: Member | 1,380 Posts
There are also various indicators you can use to find get that info. Ex i-profittracker:
http://www.forexfactory.com/showthre...29#post4430629
 
 
  • Post #4
  • Quote
  • Dec 7, 2018 8:23am Dec 7, 2018 8:23am
  •  forexify
  • | Joined Dec 2018 | Status: Junior Member | 1 Post
Quoting hayseed
Disliked
hey tiger..... it kinda depends on how you intend to select the day.... extern string date = "2011.3.1 00:00"; in this case you would use OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) to talley the results for that day...... or perhaps you might want a running total of every day.... this can be done via an indicator or a funtion of an ea..... the results would be sent using FILE_CSV|FILE_WRITE to your files folder in metatrader..... such as below...... other methods exist..... in any event, the day must be included in your terminals order history.......
Ignored
Hi, hayseed! Would you mind sharing your MQL4 code to get this one? Thanks!
 
 
  • Post #5
  • Quote
  • Last Post: Dec 7, 2018 6:24pm Dec 7, 2018 6:24pm
  •  komposter
  • | Joined Oct 2009 | Status: Just a human | 78 Posts
Quoting tigerbalm
Disliked
Hello, Any expert could give me the light of how I can sum up total loss/profit of certain day on MT4 ? thanks
Ignored
Take this script:
Inserted Code
#property strict
#property script_show_inputs
 
input datetime StartDate = D'2018.12.06';
input int DurationHours = 24;
 
void OnStart()
{
double total_day_profit = 0.0;
for ( int z = OrdersHistoryTotal()-1; z >= 0; z -- )
{
if ( !OrderSelect( z, SELECT_BY_POS, MODE_HISTORY ) ) continue;
if ( OrderType() != OP_BUY && OrderType() != OP_SELL ) continue;
if ( OrderCloseTime() < StartDate || OrderCloseTime() >= StartDate+DurationHours*60*60 ) continue;
 
total_day_profit += (OrderProfit() + OrderSwap() + OrderCommission());
}
Alert( "Profit for ", TimeToString( StartDate, TIME_DATE ), " - ", 
TimeToString( StartDate+DurationHours*60*60, TIME_DATE ),": ", 
DoubleToString( total_day_profit, 2 ), " ", AccountCurrency() );
}

Attached Image

Attached Image
 
 
  • Platform Tech
  • /
  • How can I find the total Profit/Loss of the day on MT4?
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023