code: def next(self):
      # Skip the training, in-sample data
      if len(self.data) < N_TRAIN:
          return
  
      # Proceed only with out-of-sample data. Prepare some variables
      high, low, close = self.data.High, self.data.Low, self.data.Close
      current_time = self.data.index[-1]
  
      # Forecast the next movement
      X = get_X(self.data.df.iloc[-1:])
      forecast = self.clf.predict(X)[0]
  
      # Update the plotted "forecast" indicator
      self.forecasts[-1] = forecast
  
      # If our forecast is upwards and we don't already hold a long position
      # place a long order for 20% of available account equity. Vice versa for short.
      # Also set target take-profit and stop-loss prices to be one price_delta
      # away from the current closing price.
      upper, lower = close[-1] * (1 + np.r_[1, -1] * self.price_delta)
  
      if forecast == 1 and not self.position.is_long:
          self.buy(size=0.2, tp=upper, sl=lower)
      elif forecast == -1 and not self.position.is_short:
          self.sell(size=0.2, tp=lower, sl=upper)
  
      # Additionally, set aggressive stop-loss on trades that have been open
      # for more than two days
      for trade in self.trades:
          if current_time - trade.entry_time > pd.Timedelta("2 days"):
              if trade.is_long:
                  trade.sl = max(trade.sl, low)
              else:
                  trade.sl = min(trade.sl, high)
  
file_path: backtesting.py/doc/examples/Trading with Machine Learning.py
imports: from backtesting.test import EURUSD, SMA
  import numpy
  import pandas
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.model_selection import train_test_split
  from backtesting import Backtest, Strategy
label_desc: Use image node_id 2 for calling the MLTrainOnceStrategy obj's underlying member method code with example usage: obj.next() without return types