SniperGold_ML/repaired/post_purge/SniperGold_ML_postpurge.mqh

73 lines
5.7 KiB
MQL5
Raw Permalink Normal View History

//+------------------------------------------------------------------+
//| SniperGold_ML.mqh - model AI/ML tertanam (dihasilkan otomatis) |
//+------------------------------------------------------------------+
//| fitur : 19
//| hidden : 12
//| horizon label : 24 bar | ambang 0.75 x ATR
//| AUC validasi : 0.6796 | AUC long: 0.6582 | AUC short: 0.6582
//| akurasi test : -
//| sampel : train 30304 / test 11872
//| dibuat : 2026-08-21 | XAUUSDc | M15
//| versi model : v20260821_postpurge
//+------------------------------------------------------------------+
#ifndef SNIPERGOLD_ML_MQH
#define SNIPERGOLD_ML_MQH
#define SGML_NF 19
#define SGML_NH 12
#define SGML_VER "v20260821_postpurge"
// fitur: htf1_bias, htf2_bias, htf3_bias, swing_trend, internal_trend, chart_bias, eq_pos_norm, sweep_dir, choch_dir, choch_confirms, eqh_swept, eql_swept, delta_sign, delta_mag, dist_high_atr, dist_low_atr, mom20_atr, range_atr, confluence
double SGML_MEAN[19]={0.313159979,0.221356917,0.168195618,0.191327878,0.128365892,0.128563886,0.631532247,-0.0319759768,0.198158659,0.275475185,0.71125924,0.985810454,0.122756072,0.0298338514,3.57599368,6.31845751,0.39402732,13.9611079,49.969905};
double SGML_STD[19]={0.949700388,0.932147919,0.984698584,0.980012111,0.990561594,0.990535916,4.0150744,0.998183661,0.977827333,0.446753408,0.453177155,0.118271733,0.992436873,0.192542144,5.72624758,4.19967078,2.84353016,11.5083184,16.8037783};
// W1[NF][NH] (baris-mayor)
double SGML_W1[19][12]={
{0.4468106,-0.434652364,-0.203314023,0.349460814,-0.924408346,-0.046383747,0.376378557,0.248371385,-0.403217638,-0.751228729,-0.0465093859,0.611162224},
{-1.1658588,1.49331582,-0.189246057,-0.0683601988,-0.022378559,-0.161803861,-0.180152868,-0.135547382,-0.0719678066,-0.592926255,-0.0409674808,0.756419703},
{0.160825282,-0.77386584,0.352418871,0.47029494,-0.130971424,-0.115429432,0.335337183,-0.666008673,0.157787468,0.00897288587,0.202289489,0.542152295},
{-0.188402718,-0.165258049,-1.43886678,-0.905685523,1.00134894,1.34660559,-1.23755663,-0.813571242,-0.676587115,-0.0534391115,0.751026169,0.675371447},
{0.274615836,0.110891958,-0.594341816,0.317806354,-0.77797124,-0.276537545,0.117286972,-0.227460537,-0.044854413,0.563128823,-0.158820726,-0.0795442371},
{0.284274641,0.554581762,0.0418384152,-0.446474429,-0.0714018987,-0.104355532,-0.0551804889,0.354027212,-0.0795438708,0.0342952154,0.0301378159,-0.335881331},
{-1.53756167,-0.138563756,0.0232882368,0.313181889,-0.105499629,-0.335309183,0.775197271,-0.0784970803,-1.33579149,0.0146029269,0.363415626,-1.03085622},
{-0.634959629,-0.383566345,0.0540727559,0.0293681021,0.0538086701,0.0852754703,0.0150730063,-0.150443161,-0.300251338,-0.0588789067,-0.751981967,-0.759192142},
{-0.22161181,-0.388228165,-0.735612059,-0.999582819,-0.046830907,0.200286704,-0.273928741,0.361146412,-0.0544080574,0.360413796,-0.40946754,0.151127214},
{0.169956072,-0.095902953,0.767055336,0.360985281,0.150549631,-0.600851096,0.346323843,-0.476282449,0.0907715427,-0.0062597309,1.06347585,-0.0887853815},
{0.288247408,0.482728041,0.468399276,0.878478249,0.0859750862,0.190256763,-0.0233613516,-0.176786512,-0.200682626,-0.346267303,0.237829018,-0.33623448},
{0.149291743,-0.310142606,-0.137794882,-0.330249591,-0.258000771,0.268261845,2.14894703,0.781508029,-0.0985019226,-0.340205978,-0.262687841,-0.0342018729},
{-0.156169122,0.0623776646,0.062267705,0.0319171749,-0.0371478044,0.172464123,-0.0269923088,0.0546952369,0.0469462384,0.0698542967,-0.00538450612,0.267588833},
{-0.0575178101,-0.195070565,-0.00401291235,0.0792477852,-0.0513849819,-0.241095629,0.0824772744,0.0856060945,0.0499006445,0.0194359128,-0.242409865,-0.00210908568},
{0.0909163055,-0.635118014,0.749658023,0.119491372,1.22863493,-0.756050719,-0.503324515,0.819571936,2.13308328,1.1495563,-0.537151605,1.23910509},
{0.971340743,0.17911734,-0.759293339,-0.0416232278,0.671490015,-0.773977077,1.25844637,-0.660749192,-0.0252022823,0.7137076,0.810286929,0.0667139554},
{-0.347894639,0.211679425,-0.113454885,-0.420827342,0.0455204529,-0.269387763,-0.298668435,0.413559985,0.220896473,0.202337586,-0.520953704,-0.38491308},
{-0.879108456,0.295967981,-0.256975122,-1.12735665,-0.0581110328,-0.0423142139,0.519446986,0.157041626,0.447006513,0.295216511,-0.209392943,-0.0678305568},
{0.570600129,0.213946906,-0.564918702,-1.00039625,-0.158020383,0.422712739,0.0110521129,0.0606879631,0.372906531,-0.012234443,0.179532095,1.19597909}
};
double SGML_B1[12]={-0.251428005,-0.865076901,-1.32533449,-0.277419519,-0.184412279,-0.569847082,-0.905977374,-1.46360926,0.652913659,-1.14712164,-0.377479691,-0.066141156};
double SGML_W2L[12]={-0.681719882,-0.790431532,-1.21992858,0.716003261,-0.826775664,0.681369939,-0.887634294,-1.15491238,1.33926089,-0.935750072,0.835984097,-0.650629271};
double SGML_B2L=0.892824443;
double SGML_W2S[12]={0.681720298,0.79043183,1.21992873,-0.716002972,0.82677595,-0.681371525,0.887634604,1.15491307,-1.33926094,0.935750421,-0.835983988,0.65062936};
double SGML_B2S=-0.892827137;
double SGML_Logit(const double &f[],int out){
double z[SGML_NF],h[SGML_NH];
for(int j=0;j<SGML_NF;j++)
z[j]=(SGML_STD[j]>0.0)?(f[j]-SGML_MEAN[j])/SGML_STD[j]:0.0;
for(int i=0;i<SGML_NH;i++){
double s=SGML_B1[i];
for(int j=0;j<SGML_NF;j++) s+=z[j]*SGML_W1[j][i];
h[i]=(s>0.0)?s:0.0;
}
double o=(out==0?SGML_B2L:SGML_B2S);
for(int i=0;i<SGML_NH;i++) o+=h[i]*(out==0?SGML_W2L[i]:SGML_W2S[i]);
return o;
}
double SGMLProbLong(const double &f[]){
double o=SGML_Logit(f,0);
return 1.0/(1.0+MathExp(-(o*0.69125148+0.193456637)));
}
double SGMLProbShort(const double &f[]){
double o=SGML_Logit(f,1);
return 1.0/(1.0+MathExp(-(o*0.691251237+-0.193455079)));
}
double SGMLProb(const double &f[]){ return SGMLProbLong(f); }
#endif