In this task, you should translate pykalman (https://github.com/pykalman/pykalman/blob/master/pykalman/standard.py#L920) to MQL5, features that must be translated:
initilization: KalmanFilter(transition_matrices=A,transition_covariance=Q)
function em: kf.em(z)
function smooth: x_mean,x_covar=kf.smooth(z)
function filter_update: kf.filter_update(filtered_state_mean=x_mean, filtered_state_covariance=x_covar) and variant with "observation"
A and Q is a CMatrixDouble(in test case it's (3,3)) matrix (from <Math/Alglib/matrix.mqh>)
z is a double[] array
x_mean and x_covar is a CMatrixDouble, it's the output of kf.smooth() step
I will provide a copy of test data to execute and validate this task, and a copy of python code too
I don't want to use python, just mql5
Ordini simili
Já tenho um código MQL5 com uma base do funcionamento. Basicamente o EA traça um canal na virada do dia (penso que utilizar horário seria melhor em razão da diferença entre corretoras), com base em um número x de candles, calcula e posiciona ordens stop com base em % do capital. Caso uma ordem aberta venha a stopar, o EA deve realizar uma virada de mão com base no mesmo canal, contudo recalculando o lote para que
//+------------------------------------------------------------------+ //| EA Cruzamento de Médias MT5 | //+------------------------------------------------------------------+ #property strict #include <Trade/Trade.mqh> CTrade trade; //---- Inputs input int FastMAPeriod = 20; input int SlowMAPeriod = 50; input double LotSize = 0.01; input int StopLoss = 300; input int TakeProfit = 600; //----