Forex



Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 09-04-2006, 03:04 PM
Junior Member
 
Join Date: Jul 2006
Posts: 6
zleepan is on a distinguished road
How to calculate profit in ea

Been looking around and did not find my answer for this question

i want to know how to calculate the profit/loss

but i dont want it to calculate the totalprofit so using orderprofit will not work because it calculates the profit loss on all open pairs.

here is an example

i have the following open positions

i want to calculate the profit/loss on this hedge
Long gbpusd
short eurusd

and on this hedge
long eurusd
long usdchf

the to hedges should be calculated seperatly



zleepan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 09-04-2006, 03:24 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 722
Kalenzo is on a distinguished road
First selcect order that u want to count (by magic number or position , and currency)

And then:

For long orders:
Bid - OrderOpenPrice() - Spread;
For short orders
OrderOpenPrice - Bid;
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 09-06-2006, 02:47 PM
Junior Member
 
Join Date: Nov 2005
Posts: 1
forex_trader is on a distinguished road
you can use:

if(OrderSelect(10, SELECT_BY_POS)==true)
Print("Profit for the order 10 ",OrderProfit());
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 09-06-2006, 02:49 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 722
Kalenzo is on a distinguished road
Quote:
Originally Posted by forex_trader
you can use:

if(OrderSelect(10, SELECT_BY_POS)==true)
Print("Profit for the order 10 ",OrderProfit());
Hi forex_trader, did u read the question?
Quote:
Originally Posted by zleepan
but i dont want it to calculate the totalprofit so using orderprofit will not work because it calculates the profit loss on all open pairs.
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 09-06-2006, 03:11 PM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 319
phoenix is on a distinguished road
buy :
{(OrderClosePrice-OrderOpenPrice)*lotsize*ContractSize}/OrderClosePrice

sell :
{(OrderOpenPrice-OrderClosePrice)*lotsize*ContractSize}/OrderClosePrice
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 11-23-2006, 12:58 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Lightbulb Profit!

Quote:
Originally Posted by Kalenzo
First selcect order that u want to count (by magic number or position , and currency)

And then:

For long orders:
Bid - OrderOpenPrice() - Spread;
For short orders
OrderOpenPrice - Bid;
Maybe this formula better:

PHP Code:
if(OrderType()==OP_BUY
profit = (Bid OrderOpenPrice()) / MarketInfo(OrderSymbol(),MODE_POINT); 

            if(
OrderType()==OP_SELL)
profit = (OrderOpenPrice() - Ask) / MarketInfo(OrderSymbol(),MODE_POINT); 
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to calculate Average Daily Range? ycomp Metatrader 4 80 10-21-2009 08:48 AM
how to calculate average high anthonyrae Metatrader 4 2 02-22-2007 12:46 PM
How i calculate lots? DooMGuarD Questions 4 05-29-2006 10:12 PM
profit Vs Profit factor cardio Metatrader 4 4 02-10-2006 07:24 PM


All times are GMT. The time now is 04:33 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.