How to get my last order profit?
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); }
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.