stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Code for Trade Entry Price
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=654
Page 1 of 1
Author:  Skollie [ Fri Jun 29, 2012 6:40 am ]
Post subject:  Code for Trade Entry Price

I have constructed an EA with the help of a commercial EA Strategy Builder but need to ad code that refers to the trade entry price. This is necessary for adding a trading condition that the trade only be closed if the previous bar close is bigger than the price at which the trade was entered (for long trade) and reverse for a short trade. Or alternatively, if that might be easier, that the trade only be closed if in profit.

Is there anyone willing to help me out with this code or at least point me in the right direction? :?

Anton
Author:  garyfritz [ Fri Jun 29, 2012 3:46 pm ]
Post subject:  Re: Code for Trade Entry Price

I believe you're looking for OrderOpenPrice(). Here's a sample from the online help:

Code: Select all

 if(OrderSelect(10, SELECT_BY_POS)==true)
    Print("open price for the order 10 ",OrderOpenPrice());
  else
    Print("OrderSelect returned the error of ",GetLastError());
Author:  Skollie [ Sat Jun 30, 2012 2:24 pm ]
Post subject:  Re: Code for Trade Entry Price

Thank you, much appreciated.
All times are UTC Page 1 of 1