DoubleToStr(High[iHighest(NULL,PERIOD_H4,MODE_HIGH,5,2)], 5)
You are finding the highest of bars 2 to 6, not 2 to 5.
If you run this on the H1 chart and the highest bar on the H4 chart is n
You then find the high of the nth bar of the H1 chart
That is why it appears to work correctly on the H4 chart
-
Play videoPlease edit your post.
For large amounts of code, attach it.
DoubleToStr(High[iHighest(NULL,PERIOD_H4,MODE_HIGH,5,2)], 5)
You are mixing apples and oranges
-
Play videoPlease edit your post.
For large amounts of code, attach it.
- You are mixing apples and oranges
#include <stdlib.mqh> #include <WinUser32.mqh> // exported variables // local variables double PipValue=1; // this variable is here to support 5-digit brokers bool Terminated = false; string LF = "\n"; // use this in custom or utility blocks where you need line feeds int NDigits = 4; // used mostly for NormalizeDouble in Flex type blocks int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names int current = 0; int init() { NDigits = Digits; if (false) ObjectsDeleteAll(); // clear the chart Comment(""); // clear the chart return (0); } // Expert start int start() { if (Bars < 10) { Comment("Not enough bars"); return (0); } if (Terminated == true) { Comment("EA Terminated."); return (0); } OnEveryTick422(); return (0); } void OnEveryTick422() { PipValue = 1; if (NDigits == 3 || NDigits == 5) PipValue = 10; PrintFunctionsToChart490(); } void PrintFunctionsToChart490() { string temp = "Some Text\n"; temp = temp + "------------------------------------------------\n" + "Some text " + DoubleToStr(DoubleToStr(High[iHighest(NULL,PERIOD_H4,MODE_HIGH,5,2)], 5), 5) + "\n" + "Some text " + DoubleToStr(0, 5) + "\n" + "Some text " + DoubleToStr(0, 5) + "\n" + "Some text " + DoubleToStr(0, 5) + "\n" + "------------------------------------------------\n"; Comment(temp); } int deinit() { if (false) ObjectsDeleteAll(); return (0); }
- You didn't edit your original post's using SRC as Requested.
- I only posted one message and it had no code. It only quoted your line like the one below. Do you replaced your line with your line and got the same results. Why are you surprised?
oubleToStr(High[iHighest(NULL,PERIOD_H4,MODE_HIGH,5,2)
Since your code has exactly the same problem as your original post, you didn't bother to follow the links I provided and learn why, and you didn't bother to read GunRai's post which said the same thing. You've wasted enough of people's time
You are finding the highest of bars 2 to 6, not 2 to 5.
If you run this on the H1 chart and the highest bar on the H4 chart is n
You then find the high of the nth bar of the H1 chart
That is why it appears to work correctly on the H4 chart
Hi Guys please bare with me here for asking questions that seem basic. I know understand your meaning GumRai. My next question is , is it then possible to do what I am trying to do, which is to fetching the exact value of the highest high from a higher time frame. ( My apologies for the waste of time)
Of course it is possible.
You just need to learn the difference between
High[] and iHigh()
You already know how to use iHighest, so it should be simple for you to use iHigh
Of course it is possible.
You just need to learn the difference between
High[] and iHigh()
You already know how to use iHighest, so it should be simple for you to use iHigh
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi , it seems as if when using the iHighest syntex fetching a value from a higher time frame does not work correctly. The value that is fetched does not exist on the specified time frame's candle highs. When checking this by printing functions to chart the are discrepancies on the smaller time frames i.e. 15min,30min,1hr. The values are fetched from 4Hr in this example. however when using syntex (iHighest) on the 4Hr chart , fetching values from the same chart , it work fine. Please check for me on yourside and let me if fetching iHighest from a higher time frame works fine.
#include <stdlib.mqh>
#include <WinUser32.mqh>
// exported variables
// local variables
double PipValue=1; // this variable is here to support 5-digit brokers
bool Terminated = false;
string LF = "\n"; // use this in custom or utility blocks where you need line feeds
int NDigits = 4; // used mostly for NormalizeDouble in Flex type blocks
int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names
int current = 0;
int init()
{
NDigits = Digits;
if (false) ObjectsDeleteAll(); // clear the chart
Comment(""); // clear the chart
return (0);
}
// Expert start
int start()
{
if (Bars < 10)
{
Comment("Not enough bars");
return (0);
}
if (Terminated == true)
{
Comment("EA Terminated.");
return (0);
}
OnEveryTick309();
return (0);
}
void OnEveryTick309()
{
PipValue = 1;
if (NDigits == 3 || NDigits == 5) PipValue = 10;
PrintFunctionsToChart397();
}
void PrintFunctionsToChart397()
{
string temp = "Some Text\n";
temp = temp + "------------------------------------------------\n"
+ "Highest high from bar(2) to bar(5) " + DoubleToStr(High[iHighest(NULL,PERIOD_H4,MODE_HIGH,5,2)], 5) + "\n"
+ "Some text " + DoubleToStr(0, 5) + "\n"
+ "Some text " + DoubleToStr(0, 5) + "\n"
+ "Some text " + DoubleToStr(0, 5) + "\n"
+ "------------------------------------------------\n";
Comment(temp);
}
int deinit()
{
if (false) ObjectsDeleteAll();
return (0);
}