This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community

Does anybody know how to get value OHLC on the previous bar?


Back to topics list
avatar
4
Andy2b2 2005.06.29 14:22 
Dear all,
I’m using MT3 need some advise… does anybody knows how to get value OHLC from the previous bars?
regards,
Andy
avatar
4
Andy2b2 2005.06.29 14:23 
Dear all,
I’m using MT3 need some advise… does anybody knows how to get value OHLC from the previous bars?
regards,
Andy
avatar
4464
Slawa 2005.06.29 15:18 
Open[1], High[1], Low[1], Close[1]
avatar
4
Andy2b2 2005.07.03 10:26 
Hi Slawa.....tx for your answer....
but one more question.... is it the same way if we want to know the value of indicator in the previuos bars?
for example: I want to know the value of RSI on the last 2 or 3 bars from the current bar.....
avatar
4
Andy2b2 2005.07.03 10:26 
Hi Slawa.....tx for your answer....
but one more question.... is it the same way if we want to know the value of indicator in the previuos bars?
for example: I want to know the value of RSI on the last 2 or 3 bars from the current bar.....
avatar
129
Vooch 2005.07.03 10:32 
This is how you do it in MetaTrader 4:

double rsi0 = iRSI(NULL,Period(),14,PRICE_TYPICAL,0);  // this bar
double rsi1 = iRSI(NULL,Period(),14,PRICE_TYPICAL,1);  // previous bar
double rsi2 = iRSI(NULL,Period(),14,PRICE_TYPICAL,2);  // 2 bars away
double rsi3 = iRSI(NULL,Period(),14,PRICE_TYPICAL,3);  // 3 bars away



I'm not sure about MT3, but it might be very close.

Back to topics list  
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets