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 can use:
if(OrderSelect(10, SELECT_BY_POS)==true)
Print("Profit for the order 10 ",OrderProfit());
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?
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.
buy :
{(OrderClosePrice-OrderOpenPrice)*lotsize*ContractSize}/OrderClosePrice
sell :
{(OrderOpenPrice-OrderClosePrice)*lotsize*ContractSize}/OrderClosePrice
Profit!
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:
profit = (Bid - OrderOpenPrice()) / MarketInfo(OrderSymbol(),MODE_POINT);
if(OrderType()==OP_SELL)
profit = (OrderOpenPrice() - Ask) / MarketInfo(OrderSymbol(),MODE_POINT);- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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