INNER CODE UNIT · Python
NewCandleUpdate
Mo-Khalifa96/Forex-Trading-Bot · TimeProcessing.py:23
def NewCandleUpdate(tframe: str, CandlesRetrieved: int):
'''
Returns True if a new candle starts or emerges based on the given trading timeframe (tframe);
otherwise, returns False. By signalling to the program the start of a new candle, the program
engages in a new loop, analyzing and applying the indicator measures to the new data.\n\n
Also, if CandlesRetrieved is True, it returns False, preventing the program from analyzing the
same candle twice.\n
**Note, the function is adjusted to UTC time to track MT5 candle update times.**\n\n
Valid time inputs are:
[5m, 15m, 30m, 1h, 2h, 3h, 4h, 1d]
'''
if CandlesRetrieved is True:
return False
if tframe == '5m':