拉普拉斯轉換應用於量化交易
做交量交易的群組有熱心同學提到拉普拉斯轉換可運用在量化交易。 同時也提供了程式碼。 inputs: LookbackPeriod(50), // 回看期,用于计算拉普拉斯变换 LaplaceCoeff(1.0); // 拉普拉斯变换的衰减系数 (s 值) vars: i(0), LaplaceTransformSum(0), // 拉普拉斯变换的结果 LaplacePrediction(0); // 最终的预测值 // 初始化拉普拉斯变换的总和 LaplaceTransformSum = 0; // 计算拉普拉斯变换 for i = 0 to LookbackPeriod - 1 begin // 通过指数衰减的方式来实现拉普拉斯变换的数值近似 LaplaceTransformSum = LaplaceTransformSum + Close[i] Exp(-LaplaceCoeff i); end; // 正则化处理,将变换值归一化 LaplaceTransformSum = LaplaceTransformSum / LookbackPeriod; // 预测下一期的价格,假设价格趋向于变换值 LaplacePrediction = LaplaceTransformSum; // 生成交易信号 if Close < LaplacePrediction then Buy("Laplace Long") next bar at market else if Close > LaplacePrediction then SellShort("Laplace Short") next bar at market; // 打印拉普拉斯预测值 Print("Laplace Prediction: ", LaplacePrediction); 實際測了一下,覺得 15m比...