If you're talking about comparing the current bar to the last bar it would be:
if ( (High[0]-Low[0]) < (High[1]-Low[1]) ) { // Do something }
Hi Krishna
If you're talking about comparing the current bar to the last bar it would be:
Hi,
Thank you for your reply...and even i do not know how to create indicators in this. can you pls help me out from basics.
and exactly what i require is present candle range must be lower than previous seven candles. like (h-l)<(h1-l1) and (h-l)<(h2-l2) and (h-L)<(h3-l3)....
For comparing the current candle it would be like the following. But just remember, you will be comparing the current candle before it has finished forming so the high and low could change. And to be totally correct, you should actually convert the high/low ranges into pips or points and put the whole thing in a loop but this code will work:
double myRange; myRange = High[0]-Low[0]; if ( (myRange < High[1]-Low[1]) && (myRange < High[2]-Low[2]) && (myRange < High[3]-Low[3]) && (myRange < High[4]-Low[4]) && (myRange < High[5]-Low[5]) && etc etc to 7 candles) { // Do something }
For comparing the current candle it would be like the following. But just remember, you will be comparing the current candle before it has finished forming so the high and low could change. And to be totally correct, you should actually convert the high/low ranges into pips or points and put the whole thing in a loop but this code will work:
Hi,
while iam creating, found some errors in that.. pls find the attachment jpeg...
I suggest you either read up on some basic MQL tutorials or find someone to write the code for you by raising a job in the freelance section.

- 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,
This is krishna pradeep and iam very new to MT4. iam much familiar to metastock earlier. But i want to change my platform from metastock to MT4...
In this regards i required some custom indicators help which i built in metastock personally.
how do i create formula in MT4 for (high - low)<(previous high - previous low)