A mathematical function used during training to measure model error. The loss (or cost) quantifies the difference between predicted outputs and true targets, guiding optimization. Common losses include mean squared error (MSE) for regression or cross-entropy for classification. In a forex robot, the loss function drives the learning: the training algorithm adjusts model parameters to minimize loss on historical price data. For example, a neural network minimizing MSE will iteratively update weights so its predicted prices better match actual prices. Good choices of loss (and regularization) help prevent overfitting to noise.