Bar values

 
Hi, is it possible to get bar values (open,close,high,low) of a bar at which a position was opened.
 

Yes.

iBarshift with OrderOpenTime() will give you the shift of the bar

then get  the OHLC values

 

Thanks for the response GumRai. I have another question is there a way to change the value of the date to be comprehendible instead of (in this example) 1424690100 when using OrderOpenTime(). I was able to use the OrderOpenPrice() successfully but I am having issues with OrderOpenTime().

 
N22:

Thanks for the response GumRai. I have another question is there a way to change the value of the date to be comprehendible instead of (in this example) 1424690100 when using OrderOpenTime(). I was able to use the OrderOpenPrice() successfully but I am having issues with OrderOpenTime().

I believe that if you use #property strict all prints of a datetime variable will be readable as a date, not an integer.

Otherwise, use TimeToStr() 

 

Ok , I was able to sort out the date issue , but now as seen on the attached images of my Journal  and chart window, my iBarShift doesn’t correspond with my Date. Is there any solution for this? 

{
    bool exists = false;
    for (int i=OrdersTotal()-1; i >= 0; i--)
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
    {
        if (OrderType() == OP_BUYSTOP && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
        {
            exists = true;
        }
    }
    else
    {
        Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
    }
    
    if (exists)
    {
        Print("Index of the bar for the time ",TimeToStr(OrderOpenTime(),TIME_DATE|TIME_SECONDS)," is ",iBarShift(0,0,TimeToStr(OrderOpenTime(),TIME_DATE|TIME_SECONDS)));
        
    }
}

 

 

  

 

 

You don't use a string in iBarShift

iBarShift(Symbol(),0,OrderOpenTime())

 just use OrderOpenTime()

 
ydrol and GumRai thanks for your time and information it was helpful. 
Reason: