Code for Trade Entry Price

Post Reply
Skollie
Posts: 2
Joined: Wed Jun 27, 2012 6:53 pm

Code for Trade Entry Price

Post by Skollie »

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
garyfritz

Re: Code for Trade Entry Price

Post by garyfritz »

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());
Skollie
Posts: 2
Joined: Wed Jun 27, 2012 6:53 pm

Re: Code for Trade Entry Price

Post by Skollie »

Thank you, much appreciated.
Post Reply

Return to “Coders Hangout”