• Welcome back! Thank you for being a part of this Traders Community. Let's discuss and share :)
    Selamat datang kembali! Trimakasih telah menjadi bagian dari Komunitas Trader ini. Mari berdiskusi dan berbagi :)

highest question

ahmed61089

Member
Credit Hunter
Credits
0
hello

There something i don't understand. I made a very simple code to test. So basically i want to take the highest and lowest value of yesterday. The code will work only if i run the EA on daily chart. if i put on h1 it will give me the highest and lowest of the last hour. The problem is i am specifying the time frame to D1. anyone know whats wrong?

HighCandle=High[iHighest(NULL,PERIOD_D1,MODE_HIGH,1,1)];
LowCandle=Low[iLowest(NULL,PERIOD_D1,MODE_LOW,1,1)];
Print("Highest ",HighCandle);
Print("Lowest ",LowCandle);
 
double YestHigh = iHigh(NULL, PERIOD_D1, 1);
double YestLow = iLow(NULL, PERIOD_D1, 1);
datetime open1 = iTime(NULL, PERIOD_D1, 0);
datetime open2 = iTime(NULL, PERIOD_D1, 1);
int shift1 = iBarShift(NULL, PERIOD_H1, open1, false);
int shift2 = iBarShift(NULL, PERIOD_H1, open2, false);
int candleHighest = iHighest(NULL, PERIOD_H1, MODE_HIGH, (shift2-shift1) , shift1+1);
int candleLowest = iLowest(NULL, PERIOD_H1, MODE_LOW, (shift2-shift1) , shift1+1);

PrintFormat("Highest Price : %.5f, index: %d", YestHigh, candleHighest);
PrintFormat("Lowest Price : %.5f, index: %d", YestLow, candleLowest);


Buat yang ingin belajar coding MQL, silakan bergabung di group telegram https://t.me/codeMQL
Cocok bagi pemula yang ingin belajar dari awal dengan contoh yang mudah dipahami.
 
Back
Top