Termos de Referência
Tenho um indicado funcionando em Octave deve ser Convertido para MT5 .
function [goc_errMsg, goc_res] = oc_klm_dk_1(goc_quotes, goc_gen1, goc_gen2)
try
goc_errMsg = "";
sizeQuotes = size(goc_quotes)(2);
goc_res = NaN(1,sizeQuotes);
% <Insira seu codigo a partir daqui - Inicio>
qtd=300; % quantidade de candles a serem calculados
qtd=sizeQuotes; % para calcular todos os candles descomentar
inic=sizeQuotes-qtd+1;
open=goc_quotes(7,inic:sizeQuotes);
high=goc_quotes(8,inic:sizeQuotes);
low=goc_quotes(9,inic:sizeQuotes);
close=goc_quotes(10,inic:sizeQuotes);
tick=5;
vwap = round( ( ( open .+ close .+ ( (high .+ low) ./ 2 ) ) ./ 3 ) ./ tick) .* tick ;
vwap_process_noise = ( vwap .- shift(vwap,1) ) ./ 2.0 ;
median_vwap_process_noise = median(vwap_process_noise(2:qtd)) ;
vwap_process_noise_deviations = vwap_process_noise(2:qtd) .- median_vwap_process_noise ;
MAD_process_noise = median( abs( vwap_process_noise_deviations ) ) ;
% convert this to variance under the assumption of a normal distribution
std_vwap_noise = 1.4826 * MAD_process_noise ;
process_noise_variance = std_vwap_noise * std_vwap_noise
measurement_noise = 0.666 .* ( high .- low ) ;
median_measurement_noise = median( measurement_noise(1:qtd) ) ;
measurement_noise_deviations = measurement_noise(1:qtd) .- median_measurement_noise ;
MAD_measurement_noise = median( abs( measurement_noise_deviations ) ) ;
% convert this to variance under the assumption of a normal distribution
std_measurement_noise = 1.4826 * MAD_measurement_noise ;
measurement_noise_variance = std_measurement_noise * std_measurement_noise
% Transition matrix for the continous-time system.
F = [0 0 1 0 0 0;
0 0 0 1 0 0;
0 0 0 0 1 0;
0 0 0 0 0 1;
0 0 0 0 0 0;
0 0 0 0 0 0];
% Noise effect matrix for the continous-time system.
L = [0 0;
0 0;
0 0;
0 0;
1 0;
0 1];
....