MT4 OrderOpenPrice

 

I'm trying to pull OrderOpenPrice from an open order to use for a sellstop order - a certain amount of pips for new order.

OrderSelect(123,SELECT_BY_TICKET); 

   double B3= OrderOpenPrice();



B3 is the key i'm trying to use. would this be the way to do it?  or would I do 


double B3 = OrderSelect(123,SELECT_BY_TICKET);

OrderOpenPrice();

i'm missing something, very new to coding but please help!

 
  1. Perhaps you should read the manual. OrderSelect returns a bool.
       How To Ask Questions The Smart Way. 2004
          How To Interpret Answers.
             RTFM and STFW: How To Tell You've Seriously Screwed Up.

  2. You can not use any Trade Functions until you first select an order.

 
if(OrderSelect(123,SELECT_BY_TICKET)) 

   double B3= OrderOpenPrice();

is correct as long as you know the ticket number.

It is a good idea to get into the habit of using descriptive variable names.

B3 means nothing whereas open_price is descriptive.

When you have a lot of code using variables such as a1,a2,a3 etc it can be confusing, even for the person that actually wrote the code.

Please use the code button (Alt+S) when pasting code.

Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I will move your topic to the MQL4 and Metatrader 4 section.