Edit Your Comment
Metatrader programming
Jul 24, 2017 at 06:46
Tham gia từ Jul 23, 2017
3bài viết
Hello,
I've been working on an EA using Parabolic SAR.
On the MT4 platform if I wanted access the data for the previous M5 candle I would use something like this:
int bar_shift = 1; //which bar do I want to look at?
double psar_step = 0.02; //Parabolic step
double psar_maximum = 0.2; //Parabolic maximum
double last_psar = iSAR(Symbol(),5,psar_step,psar_maximum,bar_shift);
But now would like to gather the same data on MT5, and I absolutely lost as to how it works on MT5, as it doesn't appear to me that I can address the parabolic sar data in the same manner.
The documentation for iSAR for MT5 looks like this:

It doesn't support candle shifts?
Would someone please provide me very simple example of how to get the previous bar PSAR on MT5?
Thank you for your time,
= David
I've been working on an EA using Parabolic SAR.
On the MT4 platform if I wanted access the data for the previous M5 candle I would use something like this:
int bar_shift = 1; //which bar do I want to look at?
double psar_step = 0.02; //Parabolic step
double psar_maximum = 0.2; //Parabolic maximum
double last_psar = iSAR(Symbol(),5,psar_step,psar_maximum,bar_shift);
But now would like to gather the same data on MT5, and I absolutely lost as to how it works on MT5, as it doesn't appear to me that I can address the parabolic sar data in the same manner.
The documentation for iSAR for MT5 looks like this:

It doesn't support candle shifts?
Would someone please provide me very simple example of how to get the previous bar PSAR on MT5?
Thank you for your time,
= David
Tham gia từ Jul 11, 2011
38bài viết
Aug 27, 2017 at 20:17
Tham gia từ Jul 11, 2011
38bài viết
Current bar 0, previous 1,2,3,4,5 etc....
To win you have to risk loss
Tham gia từ Aug 04, 2017
29bài viết
Aug 28, 2017 at 06:17
Tham gia từ Aug 04, 2017
29bài viết
MT5 got two different array:
1. time series array, same as MT4, a[0] -- current bar, not closed yet; a[1] -- first closed bar.
2. reversed time series array, make people sick, a[rate-total] -- current bar, not closed yet; a[rate-total-1] -- first closed bar.
1. time series array, same as MT4, a[0] -- current bar, not closed yet; a[1] -- first closed bar.
2. reversed time series array, make people sick, a[rate-total] -- current bar, not closed yet; a[rate-total-1] -- first closed bar.
Tham gia từ Oct 12, 2016
779bài viết
Aug 28, 2017 at 13:53
Tham gia từ Oct 12, 2016
779bài viết
Yes, you can't get the values directly in MT5 similar to MT4.
For accessing the values of almost all indicators you need to first use a handle to first copy the indicator values and then, you need to use "CopyBuffer" function to copy the data for all candles.
You can search the usage of Copybuffer function and you can find the answer what you are looking for. Also, help is available in the MQL5 editor.
For accessing the values of almost all indicators you need to first use a handle to first copy the indicator values and then, you need to use "CopyBuffer" function to copy the data for all candles.
You can search the usage of Copybuffer function and you can find the answer what you are looking for. Also, help is available in the MQL5 editor.
Artificial General Intelligence
Tham gia từ Jul 11, 2011
38bài viết
Aug 28, 2017 at 16:15
Tham gia từ Jul 11, 2011
38bài viết
if(CopyBuffer(SAR_handle, 0, 0, 200, SAR) <= 0) return;
ArraySetAsSeries(SAR, true);
if(CopyOpen(Symbol(), PERIOD_CURRENT, 0, 200, Open) <= 0) return;
ArraySetAsSeries(Open, true);
ArraySetAsSeries(SAR, true);
if(CopyOpen(Symbol(), PERIOD_CURRENT, 0, 200, Open) <= 0) return;
ArraySetAsSeries(Open, true);
To win you have to risk loss

*Nghiêm cấm sử dụng cho mục đích thương mại và spam, nếu vi phạm có thể dẫn đến việc chấm dứt tài khoản.
Mẹo: Đăng ảnh/url youtube sẽ tự động được nhúng vào bài viết của bạn!
Mẹo: Dùng @ để tự động điền tên người dùng tham gia vào cuộc thảo luận này.