Check previous 10 candles/bars and determine the lowest close price
Posted: Wed Feb 15, 2017 6:25 am
Hi,
How could have a function that checks the previous 10 candles/bars and determine the lowest close price of those candles/bars?I found this for MT4,but I need a function that works with mt5 ...
How could have a function that checks the previous 10 candles/bars and determine the lowest close price of those candles/bars?I found this for MT4,but I need a function that works with mt5 ...
Code: Select all
double CalcStopLoss()
{
double sl;
double LowestClose = Low[iLowest( NULL, 0, MODE_CLOSE, 10, 1 )];
double HighestClose = Low[iHighest( NULL, 0, MODE_CLOSE, 10, 1 )];
if ( Close[0] < LowestClose ) sl = Ask; //--- Buy Stop Loss
else if ( Close[0] > HighestClose ) sl = Bid; //--- Sell Stop Loss
return( sl );
}