Same problem for me. I created my own variable that I instanciate at each new order and delete when position is closed.
Hi,
I am not sure if this helps. I wrote a function that returns %-profit for my current (open!) position.
CMySignal is derived from CExpertSignal Class.
//+------------------------------------------------------------------+ //| return current position %-profit for last deal in current | //| open position | //+------------------------------------------------------------------+ double CMySignal::GetPositionProfitPercent() { uint pos_total=0; double curProfit=0.0; // pos_total=PositionsTotal(); if(pos_total>0) { // continue if current open position if(PositionSelect(Symbol())) // continue if open position is for chart symbol { curProfit=(PositionGetDouble(POSITION_PRICE_CURRENT)/PositionGetDouble(POSITION_PRICE_OPEN)-1.0)*100.0; } } return(curProfit); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
run the above code from 2012.1.1 to 2012.1.10 in "AUDUSD" symbol, The log is:
Thank a lot in advance for any help.