Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-04-2006, 02:04 PM
Junior Member
 
Join Date: Jul 2006
Posts: 4
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!
Reply With Quote
  #2 (permalink)  
Old 09-04-2006, 02:24 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 696
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!
Reply With Quote
  #3 (permalink)  
Old 09-06-2006, 01: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!
Reply With Quote
  #4 (permalink)  
Old 09-06-2006, 01:49 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 696
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!
Reply With Quote
  #5 (permalink)  
Old 09-06-2006, 02:11 PM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 287
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!
Reply With Quote
  #6 (permalink)  
Old 11-23-2006, 11:58 AM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 987
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!
Reply With Quote
Reply

Bookmarks

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
how to calculate average high anthonyrae Metatrader 4 2 02-22-2007 11:46 AM
How i calculate lots? DooMGuarD Questions 4 05-29-2006 09:12 PM
Script to calculate Average Daily Range? ycomp Metatrader 4 10 02-28-2006 03:18 PM
profit Vs Profit factor cardio Metatrader 4 4 02-10-2006 06:24 PM


All times are GMT. The time now is 01:04 AM.



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