Highest Bar MQl4

 

There is Highest Bar and lowest bar in MQL4 but how would you program highest ATR value. 

 int HC = iHighest(_Symbol, _Period, MODE_HIGH, 100,0);
 
Sanjay Rathore:

There is Highest Bar and lowest bar in MQL4 but how would you program highest ATR value. 

Create a buffer for an array. Use the buffer on the ATR with for loop, loop should have a reset count. Return the highest value using ArrayMaximum. 

 

thanks William and Adj007, i worked it out, it was a whole array issue, similar to what you sent through.

 
Adj007 #:
Create a buffer for an array. Use the buffer on the ATR with for loop, loop should have a reset count. Return the highest value using ArrayMaximum. 

Hi Adj,

is this what you mean?

int BarIndexHigh()
{

int BarsToCheck=400;
double IndicatorValues[400];
for(int i=0;i<BarsToCheck;i++){
   IndicatorValues[i]=iATR(NULL,0,7,i);
   Print(StringConcatenate("BarIndex_",i," ATR: ",IndicatorValues[i]));     
}

int BarIndexHigh=ArrayMaximum(IndicatorValues);

return BarIndexHigh;
}
 
Adj007 #:
Create a buffer for an array. Use the buffer on the ATR with for loop, loop should have a reset count. Return the highest value using ArrayMaximum. 

Hi Adj007,


A question similarly along those lines; During a day session of trading if I had a Price doing that of the image below, how would I calculate B to C after calculating A to B.


 
Sanjay Rathore #:

Hi Adj007,


A question similarly along those lines; During a day session of trading if I had a Price doing that of the image below, how would I calculate B to C after calculating A to B.


The distance from b to c would need to be shorter than calculated a to b for ab and bc to be comfirmed further.


Sanjay Rathore #:

Hi Adj,

is this what you mean?

I believe william attatched a code on here which seemed to be ok, but I think your code isnt right again as you dont return a function into a function

 
Adj007 #:

The distance from b to c would need to be shorter than calculated a to b for ab and bc to be comfirmed further.


I believe william attatched a code on here which seemed to be ok, but I think your code isnt right again as you dont return a function into a function

Thanks Adj007, William's programming worked thankfully. With the B to C component; would I then take the highest and lowest price within that distance? So, for instance; 

HC= Highest Candle
LC= Lowest Candle
Dist1= ??? 
Dist2= ???

double BtoC = (HC+(HC-LC))

if(dist2 < dist1 && BtoC*(ATR Value))

{
OrderSend()...
}
Reason: