//+------------------------------------------------------------------+ //| AIBRAIN OTC v46.0 FULL - All Features + Fixes | //| Fixed: Crowd (20 candles, 75% threshold, sum 100) | //| Fixed: HRN (candle close based) | //| Fixed: TFA (M1 HA priority) | //| Added: Next Candle Prediction (4 factors OTC optimized) | //| Added: Volume spike (avg of last 5 candles) | //| Kept: All original indicators (Neural, Fractal, QMR, etc.) | //+------------------------------------------------------------------+ #property copyright "AIBRAIN ULTIMATE - KM RANA" #property version "46.0 FULL" #property strict #property indicator_chart_window // ============================================================ // INPUT PARAMETERS // ============================================================ input string I1 = "===== CROWD SETTINGS ====="; input int CROWD_LOOKBACK = 20; input double CROWD_THRESHOLD = 75.0; input bool CROWD_SIMPLE_METHOD = true; input string I2 = "===== VOLUME SPIKE ====="; input double VOLUME_SPIKE_RATIO = 1.5; input string I3 = "===== NEXT CANDLE PREDICTION ====="; input bool USE_NEW_PREDICTION = true; input string I4 = "===== OTHER PAIRS ====="; input double OTHER_PAIRS_CONF_MIN = 62.0; input string I5 = "===== ENTRY TIMING ====="; input int ENTRY_MIN_SEC = 10; input int ENTRY_MAX_SEC = 35; input int LAST_SEC_BLOCK = 15; input string I6 = "===== DISPLAY ====="; input int DASHBOARD_X = 4; input int DASHBOARD_Y = 20; input int DASHBOARD_WIDTH = 650; input bool SHOW_SR_LINES = true; input bool SHOW_ROUND_NUMBERS = true; input bool SHOW_COMMON_POINTS = true; input bool SHOW_WICK_REJECTIONS = true; input bool SHOW_HTF_LEVELS = true; input bool SHOW_TIMER = true; input string I7 = "===== RISK & FILTERS ====="; input bool ENABLE_SESSION_FILTER = true; input bool ENABLE_SPIKE_FILTER = true; input bool ENABLE_LAST_SEC_BLOCK = true; input bool ENABLE_RISK_CONTROL = true; input int MAX_LOSS_STREAK = 2; input string I8 = "===== NOTIFICATIONS ====="; input bool ENABLE_NOTIFY = true; input bool ENABLE_TELEGRAM = false; input string TELEGRAM_TOKEN = ""; input string TELEGRAM_CHAT_ID = ""; // ============================================================ // CONSTANTS & COLORS // ============================================================ #define PFX "AIB46_" #define LB 18 #define MAX_LEVELS 5 #define MAX_REJ 50 #define LOOKBACK 20 #define MAX_COMMON_PTS 5 #define MAX_WICK_LINES 5 #define MAX_HTF_LEVELS 50 #define NEON_GREEN C'0,255,100' #define NEON_RED C'255,40,80' #define NEON_YELLOW C'255,220,0' #define NEON_ORANGE C'255,120,0' #define NEON_CYAN C'0,255,200' #define NEON_PURPLE C'200,0,255' #define NEON_PINK C'255,80,180' #define NEON_BLUE C'0,200,255' #define NEON_LIME C'80,255,80' #define NEON_GOLD C'255,180,0' #define DARK_BLUE_NEON C'0,100,255' #define NEON_WHITE C'220,230,255' #define CGR C'160,170,190' #define BG_DARK1 C'6,8,16' #define BG_DARK2 C'10,14,24' #define BG_DARK3 C'14,20,32' #define BG_DARK4 C'18,26,40' // ============================================================ // STRUCTURES // ============================================================ struct RejLevel { double price; int touches; }; struct HTFLevel { double price; string timeframe; string type; datetime time; int strength; bool isRound; }; // ============================================================ // GLOBAL VARIABLES // ============================================================ // Core string g_haM1="", g_haM5="", g_haBoth=""; color g_haM1Color=clrGray, g_haM5Color=clrGray; double g_brain=0, g_spm=0, g_tfa=3; double g_neural=50, g_microAI=50, g_microTrap=0, g_fractal=0; string g_tfaDetail=""; double g_accuracy=65.0; int g_accCorrect=0, g_accTotal=0; datetime g_accLastBar=0; double g_lastPredGreen=50.0; datetime g_lastPredBar=0; int g_lossStreak=0; bool g_tradingStopped=false; // Crowd int g_otcCallPct=50, g_otcPutPct=50; // Signals string g_finalSignal="WAIT"; color g_finalColor=NEON_YELLOW; datetime g_signalTime=0; string g_lastNotified=""; string g_marketMode="RANGE", g_prevMode=""; string g_strategyType="NONE", g_strategySignal="WAIT", g_strategyReason=""; // HRN double g_hrnPrice=0; bool g_hrnIsSup=true; int g_hrnBreakBars=0; datetime g_hrnScanBar=0; datetime g_hrnLastCandle=0; RejLevel g_rej[MAX_REJ]; int g_rejCnt=0; // S/R double g_resLevels[MAX_LEVELS], g_supLevels[MAX_LEVELS]; int g_resCnt=0, g_supCnt=0; datetime g_lastSRBar=0; double g_nearestRes=0, g_nearestSup=0; string g_brkStr="NO BRK"; color g_brkColor=CGR; // Common points & wick lines double g_commonPrice[MAX_COMMON_PTS]; datetime g_commonTime[MAX_COMMON_PTS]; string g_commonType[MAX_COMMON_PTS]; datetime g_commonExpire[MAX_COMMON_PTS]; int g_commonCount=0; datetime g_lastCommonScan=0; double g_wickLinePrice[MAX_WICK_LINES]; int g_wickLineTouches[MAX_WICK_LINES]; datetime g_wickLineExpire[MAX_WICK_LINES]; int g_wickLineCount=0; datetime g_lastWickScan=0; bool g_isSideways=false; // HTF levels HTFLevel g_htfLevels[MAX_HTF_LEVELS]; int g_htfLevelCount=0; datetime g_lastLevelScan=0; // QMR double qmrA=0,qmrB=0,qmrC=0,qmrD=0; datetime qmrTA=0,qmrTB=0,qmrTC=0,qmrTD=0; bool qmrActive=false; datetime qmrExpire=0; // Other pairs string g_pairNames[5], g_pairSigs[5]; double g_pairConfs[5]; int g_pairCount=0; // Neural weights double NW[36]; // Filter status string g_filterStatus="ALL CLEAR"; bool g_mtfConfirmed=true; //+------------------------------------------------------------------+ //| HELPER FUNCTIONS | //+------------------------------------------------------------------+ bool IsLineNearby(double price, double pipTol=3.0) { bool jpy=(StringFind(Symbol(),"JPY")>=0); double pip=jpy?0.01:0.0001; double tol=pipTol*pip; for(int i=ObjectsTotal()-1;i>=0;i--) { string nm=ObjectName(i); if((int)ObjectGetInteger(0,nm,OBJPROP_TYPE)==OBJ_HLINE) { double lp=ObjectGetDouble(0,nm,OBJPROP_PRICE); if(MathAbs(lp-price)=12&&h<16){sC=NEON_GOLD;return "LON+NY";} if(h>=7&&h<9){sC=NEON_CYAN;return "ASI+LON";} if(h>=7&&h<16){sC=NEON_GREEN;return "LONDON";} if(h>=12&&h<21){sC=NEON_BLUE;return "NEW YORK";} if(h>=0&&h<9){sC=NEON_ORANGE;return "ASIA";} sC=C'100,100,120'; return "SYDNEY"; } bool IsSessionActive() { int h=TimeHour(TimeGMT()); return (h>=7 && h<=21); } bool IsBigCandle(int s) { if(Bars<20) return false; double a=iATR(NULL,PERIOD_M1,14,0); return (a>0 && (High[s]-Low[s]) > a*1.8); } //+------------------------------------------------------------------+ //| HEIKEN ASHI | //+------------------------------------------------------------------+ void CalcHA() { if(Bars<10) return; ArraySetAsSeries(Open,true); ArraySetAsSeries(High,true); ArraySetAsSeries(Low,true); ArraySetAsSeries(Close,true); static double haO1[500],haC1[500]; static datetime lb1=0; ArraySetAsSeries(haO1,true); ArraySetAsSeries(haC1,true); datetime c1=iTime(NULL,PERIOD_M1,0); if(c1!=lb1) { lb1=c1; int lim=MathMin(iBars(NULL,PERIOD_M1),500); for(int i=lim-1;i>=0;i--) { haC1[i]=(Open[i]+High[i]+Low[i]+Close[i])/4.0; if(i==lim-1) haO1[i]=(Open[i]+Close[i])/2.0; else haO1[i]=(haO1[i+1]+haC1[i+1])/2.0; } } double d1=MathAbs(haC1[1]-haO1[1]), r1=High[1]-Low[1]; bool dz=(r1>0 && d1haO1[1]), be1=(!dz && haC1[1]=10) { static double haO5[200],haC5[200]; static datetime lb5=0; ArraySetAsSeries(haO5,true); ArraySetAsSeries(haC5,true); datetime c5=iTime(NULL,PERIOD_M5,0); if(c5!=lb5) { lb5=c5; int lim=MathMin(iBars(NULL,PERIOD_M5),200); for(int i=lim-1;i>=0;i--) { double o=iOpen(NULL,PERIOD_M5,i), h=iHigh(NULL,PERIOD_M5,i), l=iLow(NULL,PERIOD_M5,i), c=iClose(NULL,PERIOD_M5,i); haC5[i]=(o+h+l+c)/4.0; if(i==lim-1) haO5[i]=(o+c)/2.0; else haO5[i]=(haO5[i+1]+haC5[i+1])/2.0; } } double d5=MathAbs(haC5[1]-haO5[1]), r5=iHigh(NULL,PERIOD_M5,1)-iLow(NULL,PERIOD_M5,1); bool dz5=(r5>0 && d5haO5[1]), be5=(!dz5 && haC5[1]2.0) result=2.0; return result; } //+------------------------------------------------------------------+ //| VOLUME SPIKE (average of last N candles) | //+------------------------------------------------------------------+ double GetVolumeSpike() { if(Bars<6) return 1.0; double currVol = (double)iVolume(NULL,PERIOD_M1,1); double avgVol = 0; for(int i=2; i<=6; i++) avgVol += (double)iVolume(NULL,PERIOD_M1,i); avgVol /= 5.0; if(avgVol<=0) return 1.0; return currVol/avgVol; } //+------------------------------------------------------------------+ //| CROWD CALCULATION (FIXED: simple buyer/seller count, sum 100) | //+------------------------------------------------------------------+ void CalcCrowd() { if(Bars < CROWD_LOOKBACK) return; if(CROWD_SIMPLE_METHOD) { int buyerCount=0; for(int i=1; i<=CROWD_LOOKBACK; i++) if(Close[i] > Open[i]) buyerCount++; double buyerPct = (double)buyerCount / CROWD_LOOKBACK * 100.0; g_otcCallPct = (int)MathRound(buyerPct); g_otcPutPct = 100 - g_otcCallPct; } else { // Fallback to old wick-based (but we fix sum) int cS=0,pS=0; for(int i=1;i<=CROWD_LOOKBACK&&i0.70&&Close[i]0.70&&Close[i]>Open[i]) pS+=4; if(uw>0.55&&Close[i]0.55&&Close[i]>Open[i]) pS+=2; if(Close[i]>Open[i]) cS+=1; else if(Close[i]=0); double pip=jpy?0.01:0.0001; double sup=Low[iLowest(NULL,PERIOD_M1,MODE_LOW,LB,1)], res=High[iHighest(NULL,PERIOD_M1,MODE_HIGH,LB,1)]; double bH=MathMax(Open[1],Close[1]), bL=MathMin(Open[1],Close[1]); if(High[1]>res && bLsup) s+=4; if(High[0]>res) s-=2; if(Low[0]0?v1/va:1; if(cn>1.2 && vr>1.5) { if(Close[1]>Open[1]) s-=3; else s+=3; } } int c=0; for(int i=1;i<=30;i++) if(Close[i]>Open[i]) c++; cp=(int)(c*100.0/30.0); if(cp>=70) s-=5; if(cp<=30) s+=5; s*=1.5; int dj=0; for(int i=1;i<=8;i++) { double bd=MathAbs(Close[i]-Open[i]), rg=High[i]-Low[i]; if(rg<=0) continue; if(bdbd*3) s+=2; if(lw>bd*3) s-=2; } if(dj>=4) s*=1.5; int bu=0,be=0; for(int i=1;i<=8;i++) { if(Close[i]>Open[i]) { bu++; be=0; } else { be++; bu=0; } if(bu>=5) s-=3; if(be>=5) s+=3; } int h=TimeHour(TimeCurrent()); double mul=1.0; if((h>=0&&h<=2)||(h>=8&&h<=11)||(h>=14&&h<=17)) mul=1.20; if(h>=3&&h<=7) mul=0.90; return s*mul; } //+------------------------------------------------------------------+ //| NEURAL NETWORK (Full weights) | //+------------------------------------------------------------------+ void InitNW() { NW[0]=0.852;NW[1]=0.724;NW[2]=0.913;NW[3]=0.681;NW[4]=0.795;NW[5]=0.836;NW[6]=0.772;NW[7]=0.894; NW[8]=0.623;NW[9]=0.748;NW[10]=0.887;NW[11]=0.716;NW[12]=0.661;NW[13]=0.829;NW[14]=0.753;NW[15]=0.942; NW[16]=0.784;NW[17]=0.697;NW[18]=0.871;NW[19]=0.735;NW[20]=0.813;NW[21]=0.768;NW[22]=0.932;NW[23]=0.674; NW[24]=0.845;NW[25]=0.709;NW[26]=0.888;NW[27]=0.651;NW[28]=0.921;NW[29]=0.743;NW[30]=0.802;NW[31]=0.867; NW[32]=1.24;NW[33]=-0.93;NW[34]=1.15;NW[35]=-1.08; } double fDoji(int s) { int n=0; for(int i=s;i0&&b0.65||l>0.65)?95:(u>0.5||l>0.5)?70:0; } double fVol() { if(Bars<11) return 0; double a=0; for(int i=1;i<=10;i++) a+=iVolume(NULL,PERIOD_M1,i); a/=10.0; if(a==0) return 0; double r=(double)iVolume(NULL,PERIOD_M1,0)/a; return r>3?95:r>2?75:r>1.5?50:0; } double fMom(int s) { if(s+3>=Bars) return 0; return((Close[s]>Open[s]&&Close[s+1]Open[s+1]))?88:0; } double fSpread() { double sp=(double)MarketInfo(Symbol(),MODE_SPREAD); return sp>8?90:sp>5?70:sp>3?40:0; } double fMem(int s) { if(s+8>=Bars) return 0; int r=0; for(int i=s;iLow[i+1]&&Low[i+2]>Low[i+1]&&Close[i+2]>Open[i+2]); bool aT=(High[i]=Bars) return 0; double vN=(double)iVolume(NULL,PERIOD_M1,s), vP=(double)iVolume(NULL,PERIOD_M1,s+1); if(vP==0) return 0; double vR=vN/vP, pc=MathAbs(Close[s]-Close[s+1])/Close[s+1]*100; if(vR>2.0&&pc<0.1) return 85; if(vR>1.5&&pc<0.05) return 60; return 0; } double fFrac(int s) { if(s+4>=Bars||s<2) return 0; bool b=(Low[s]High[s-1]&&High[s]>High[s-2]&&High[s]>High[s+1]&&High[s]>High[s+2]); return (b||t)?90:0; } double NeuralBias(int s) { double f[8]; f[0]=fDoji(s)/100.0; f[1]=fWick(s)/100.0; f[2]=fVol()/100.0; f[3]=fMom(s)/100.0; f[4]=fSpread()/100.0; f[5]=fMem(s)/100.0; f[6]=fTick(s)/100.0; f[7]=fFrac(s)/100.0; double h[4]={0,0,0,0}; for(int i=0;i<4;i++) { for(int j=0;j<8;j++) h[i]+=f[j]*NW[j*4+i]; h[i]=MathMax(0,h[i]-0.08); } double o=0; for(int i=0;i<4;i++) o+=h[i]*NW[32+i]; double r=50.0+o*22.0; return r>96?96:r<4?4:r; } double NeuralBiasFast() { return NeuralBias(0)*0.3 + NeuralBias(1)*0.7; } //+------------------------------------------------------------------+ //| MICRO AI & MICRO TRAP | //+------------------------------------------------------------------+ double CalcMicroAI() { if(Bars<20) return 50.0; double score=50.0; for(int i=1;i<=5;i++) { double r=High[i]-Low[i]; if(r<=0) continue; double uw=(High[i]-MathMax(Open[i],Close[i]))/r, lw=(MathMin(Open[i],Close[i])-Low[i])/r, w=(6.0-i)/5.0; if(uw>0.60) score-=w*15; if(lw>0.60) score+=w*15; } double pos5=0; for(int i=1;i<=5;i++) { double r=High[i]-Low[i]; if(r<=0) continue; pos5+=(Close[i]-Low[i])/r; } score+=(pos5/5.0-0.5)*20.0; int gc=0,rc=0; for(int i=1;i<=8;i++) { if(Close[i]>Open[i]) gc++; else if(Close[i]0) { double vr=v1/vA; if(vr>1.5 && Close[1]>Open[1]) score+=8; if(vr>1.5 && Close[1]65) score-=10; if(r1>r5 && Close[1]Close[5]) score-=6; return MathMax(5.0,MathMin(95.0,score)); } int CalcMicroTrap() { if(Bars<20) return 0; int score=0; double r=High[1]-Low[1]; if(r>0) { double uw=(High[1]-MathMax(Open[1],Close[1]))/r, lw=(MathMin(Open[1],Close[1])-Low[1])/r; if(uw>0.65) score+=30; else if(uw>0.50) score+=15; if(lw>0.65) score+=20; else if(lw>0.50) score+=10; } double v1=(double)iVolume(NULL,PERIOD_M1,1), v2=(double)iVolume(NULL,PERIOD_M1,2); if(v2>0 && v1/v2>2.0) score+=25; else if(v2>0 && v1/v2>1.5) score+=12; double rsi=iRSI(NULL,PERIOD_M1,14,PRICE_CLOSE,1); if(rsi>78 || rsi<22) score+=20; else if(rsi>72 || rsi<28) score+=10; if((High[1]>g_nearestRes && Close[1]g_nearestSup)) score+=25; bool aG=(Close[1]>Open[1] && Close[2]>Open[2] && Close[3]>Open[3]), aR=(Close[1]6*1.5) score+=10; return MathMin(100,score); } //+------------------------------------------------------------------+ //| ADVANCED FRACTAL | //+------------------------------------------------------------------+ double CalcAdvancedFractal() { if(Bars<15) return 0; double score=0; for(int i=2;i<=8&&i+2High[i-1] && High[i]>High[i-2] && High[i]>High[i+1] && High[i]>High[i+2]) { double d=(High[i]-Close[0])/Point; if(d<50 && d>-10) score+=35; } if(Low[i]-10) score+=25; } } int dj=0; for(int i=1;i<=6;i++) { double b=MathAbs(Close[i]-Open[i]), rg=High[i]-Low[i]; if(rg>0 && b=3) score+=25; double r1=High[1]-Low[1]; if(r1>0) { double uw1=(High[1]-MathMax(Open[1],Close[1]))/r1, lw1=(MathMin(Open[1],Close[1])-Low[1])/r1; if(uw1>0.70 || lw1>0.70) score+=20; } return MathMin(100,score); } //+------------------------------------------------------------------+ //| TFA (FIXED: M1 HA priority) | //+------------------------------------------------------------------+ double CalcTFA(string &detail) { if(Bars<30) { detail="Bars low"; return 3.0; } double score=0; string p=""; double adx=iADX(NULL,PERIOD_M1,14,PRICE_CLOSE,MODE_MAIN,1); double adxSc=(adx>=25)?1.0:(adx>=20)?0.6:(adx>=15)?0.3:0.1; score+=adxSc; p+="ADX:"+((adxSc>=0.6)?"+":"-")+" "; double v1=iVolume(NULL,PERIOD_M1,1), vA=0; for(int i=2;i<=6;i++) vA+=iVolume(NULL,PERIOD_M1,i); vA=(vA>0)?vA/5.0:1; double vr=v1/vA; double volSc=(vr>=2.0)?1.0:(vr>=1.5)?0.7:(vr>=1.1)?0.4:0.1; score+=volSc; p+="VOL:"+((volSc>=0.5)?"+":"-")+" "; double rsi=iRSI(NULL,PERIOD_M1,14,PRICE_CLOSE,1); double rsiSc=0.2; if(rsi>=60||rsi<=40) rsiSc=1.0; else if(rsi>=55||rsi<=45) rsiSc=0.6; score+=rsiSc; p+="RSI:"+((rsiSc>=0.6)?"+":"-")+" "; double atr=iATR(NULL,PERIOD_M1,14,1), cs=High[1]-Low[1]; double atrSc=0.2; if(atr>0) { double r=cs/atr; if(r>=0.7&&r<=1.5) atrSc=1.0; else if(r>=0.5&&r<=2.0) atrSc=0.6; else atrSc=0.3; } score+=atrSc; p+="ATR:"+((atrSc>=0.6)?"+":"-")+" "; double body=MathAbs(Close[1]-Open[1]), range=High[1]-Low[1]; double bdySc=0.2; if(range>0) { double br=body/range; if(br>=0.6) bdySc=1.0; else if(br>=0.4) bdySc=0.6; else if(br>=0.2) bdySc=0.3; } score+=bdySc; p+="BODY:"+((bdySc>=0.6)?"+":"-")+" "; double sesSc=IsSessionActive()?1.0:0.4; score+=sesSc; p+="SES:"+((sesSc>=0.7)?"+":"-"); double finalScore=MathMin(6.0,score); int rounded=(int)MathRound(finalScore); string dir="MIX"; bool m1Bull=(g_haM1=="HA BULLISH 1"), m1Bear=(g_haM1=="HA BEARISH 1"); bool m5Bull=(g_haM5=="HA BULLISH 5"), m5Bear=(g_haM5=="HA BEARISH 5"); if(m1Bull && m5Bull) dir="STRONG UP"; else if(m1Bear && m5Bear) dir="STRONG DOWN"; else if(m1Bull && m5Bear) dir="UP"; // M1 wins else if(m1Bear && m5Bull) dir="DOWN"; else if(m1Bull) dir="UP"; else if(m1Bear) dir="DOWN"; detail = p + " | " + IntegerToString(rounded)+"/6 "+dir; g_tfaDetail = detail; return finalScore; } //+------------------------------------------------------------------+ //| MARKET BIAS | //+------------------------------------------------------------------+ string CalcMarketBias(color &bC, double brain, double rsc) { if(Bars<30){bC=NEON_YELLOW;return "CALCULATING";} double score=0; bool jpy=(StringFind(Symbol(),"JPY")>=0); double pip=jpy?0.01:0.0001; double pc=Close[0]-Close[10]; if(pc>5*pip) score+=4; else if(pc>2*pip) score+=2; else if(pc<-5*pip) score-=4; else if(pc<-2*pip) score-=2; double hh1=High[iHighest(NULL,PERIOD_M1,MODE_HIGH,5,1)], hh2=High[iHighest(NULL,PERIOD_M1,MODE_HIGH,5,6)]; double ll1=Low[iLowest(NULL,PERIOD_M1,MODE_LOW,5,1)], ll2=Low[iLowest(NULL,PERIOD_M1,MODE_LOW,5,6)]; if(hh1>hh2 && ll1>ll2) score+=4; else if(hh1hh2) score+=2; else if(hh1ema20p) score+=3; else if(ema20ema50) score+=3; else score-=3; int gC=0,rC=0; for(int i=1;i<=10;i++){if(Close[i]>Open[i])gC++; else if(Close[i]=7) score+=3; else if(rC>=7) score-=3; else if(gC>=5) score+=1; else if(rC>=5) score-=1; bool m1B=(g_haM1=="HA BULLISH 1"), m1Be=(g_haM1=="HA BEARISH 1"), m5B=(g_haM5=="HA BULLISH 5"), m5Be=(g_haM5=="HA BEARISH 5"); if(m1B&&m5B) score+=4; else if(m1Be&&m5Be) score-=4; else if(m1B) score+=2; else if(m1Be) score-=2; double adx=iADX(NULL,PERIOD_M1,14,PRICE_CLOSE,MODE_MAIN,1), pDI=iADX(NULL,PERIOD_M1,14,PRICE_CLOSE,MODE_PLUSDI,1), mDI=iADX(NULL,PERIOD_M1,14,PRICE_CLOSE,MODE_MINUSDI,1); if(adx>20){if(pDI>mDI+5) score+=4; else if(mDI>pDI+5) score-=4;} if(brain>3) score-=2; else if(brain<-3) score+=2; if(Close[1]>Open[1]) score+=1; else if(Close[1]2) score+=1; else if(rsc<-2) score-=1; if(score>=12){bC=NEON_GREEN;return "STRONG BULL";} if(score>=7){bC=NEON_GREEN;return "BULLISH";} if(score>=3){bC=NEON_CYAN;return "LIGHT BULL";} if(score<=-12){bC=NEON_RED;return "STRONG BEAR";} if(score<=-7){bC=NEON_RED;return "BEARISH";} if(score<=-3){bC=NEON_ORANGE;return "LIGHT BEAR";} bC=NEON_YELLOW;return "NEUTRAL"; } //+------------------------------------------------------------------+ //| NEXT CANDLE PREDICTION (NEW: weighted 4 factors) | //+------------------------------------------------------------------+ void CalcNextCandlePrediction(double &greenPct, double &redPct, string &action, color &actColor) { if(Bars < CROWD_LOOKBACK+5) { greenPct=50; redPct=50; action="WAIT"; actColor=NEON_YELLOW; return; } // 1. Crowd Trap (40%) int bullCount=0; for(int i=1;i<=CROWD_LOOKBACK;i++) if(Close[i] > Open[i]) bullCount++; double crowdPct = (double)bullCount / CROWD_LOOKBACK * 100.0; double crowdScore = 0; if(crowdPct >= CROWD_THRESHOLD) crowdScore = 40.0; // Extreme buyer -> RED next else if(crowdPct <= (100.0 - CROWD_THRESHOLD)) crowdScore = 40.0; // Extreme seller -> GREEN next else crowdScore = MathAbs(crowdPct - 50.0) / 50.0 * 40.0; // 2. Volume Spike (30%) double volRatio = GetVolumeSpike(); double volScore = 0; if(volRatio >= VOLUME_SPIKE_RATIO) volScore = 30.0; else volScore = (volRatio - 1.0) / (VOLUME_SPIKE_RATIO - 1.0) * 30.0; if(volScore < 0) volScore = 0; // 3. Wick Rejection (20%) double range = High[1] - Low[1]; double body = MathAbs(Close[1] - Open[1]); double wickPct = (range > 0) ? (range - body) / range : 0; double wickScore = wickPct * 20.0; // 4. Momentum Fade (10%) double mom = (Close[1] - Close[2]) / Close[2] * 100.0; double momScore = MathMin(10.0, MathAbs(mom) * 1.0); double greenBase = 0, redBase = 0; if(crowdPct >= CROWD_THRESHOLD) { redBase = crowdScore + volScore + wickScore + momScore; } else if(crowdPct <= (100.0 - CROWD_THRESHOLD)) { greenBase = crowdScore + volScore + wickScore + momScore; } else { greenBase = (crowdScore/2) + (volScore/2) + (wickScore/2) + (momScore/2); redBase = (crowdScore/2) + (volScore/2) + (wickScore/2) + (momScore/2); } double total = greenBase + redBase; if(total <= 0) { greenPct=50; redPct=50; } else { greenPct = greenBase / total * 100.0; redPct = redBase / total * 100.0; } if(greenPct >= CROWD_THRESHOLD) { action="STRONG GREEN"; actColor=NEON_GREEN; } else if(redPct >= CROWD_THRESHOLD) { action="STRONG RED"; actColor=NEON_RED; } else if(greenPct >= 60) { action="WEAK GREEN"; actColor=NEON_CYAN; } else if(redPct >= 60) { action="WEAK RED"; actColor=NEON_ORANGE; } else { action="WAIT"; actColor=NEON_YELLOW; } } //+------------------------------------------------------------------+ //| OLD ADVANCED PREDICTION (kept for fallback) | //+------------------------------------------------------------------+ void CalcAdvancedPrediction(double &gP, double &rP, string &reason, color &pC) { if(Bars<50) { gP=50; rP=50; reason="Bars low"; pC=NEON_YELLOW; return; } double green=0, red=0; double body1=MathAbs(Close[1]-Open[1]), range1=High[1]-Low[1]; double wick_ratio=(range1>0)?(range1-body1)/range1:0; if(wick_ratio>0.70 && Close[1]>Open[1]) red+=20; else if(wick_ratio>0.70 && Close[1]0.55){ if(Close[1]>Open[1]) red+=10; else green+=10; } double rsi=iRSI(NULL,PERIOD_M1,14,PRICE_CLOSE,1), cci=iCCI(NULL,PERIOD_M1,14,PRICE_TYPICAL,1); if(rsi<30 && cci<-120) green+=15; else if(rsi>70 && cci>120) red+=15; else if(rsi<40 && cci<-80) green+=8; else if(rsi>60 && cci>80) red+=8; double v1=iVolume(NULL,PERIOD_M1,1), vAvg=0; for(int i=2;i<=10;i++) vAvg+=iVolume(NULL,PERIOD_M1,i); vAvg/=9.0; double vol_ratio=(vAvg>0)?v1/vAvg:1; if(vol_ratio>2.0){ if(Close[1]>Open[1]) red+=18; else green+=18; } else if(vol_ratio>1.5){ if(Close[1]>Open[1]) red+=10; else green+=10; } bool hammer=(Low[1]==Low[iLowest(NULL,PERIOD_M1,MODE_LOW,3,1)] && Close[1]>Open[1]); bool shooting_star=(High[1]==High[iHighest(NULL,PERIOD_M1,MODE_HIGH,3,1)] && Close[1]25){ if(plusDI>minusDI+5) green+=12; else if(minusDI>plusDI+5) red+=12; else if(plusDI>minusDI) green+=6; else red+=6; } else { if(plusDI>minusDI) green+=4; else red+=4; } // HA M1+M5 (70/30 weight) double m1_haC1=(Open[1]+High[1]+Low[1]+Close[1])/4.0, m1_haC2=(Open[2]+High[2]+Low[2]+Close[2])/4.0; double m1_haO2_apx=(Open[3]+Close[3])/2.0, m1_haO1=(m1_haO2_apx+m1_haC2)/2.0; bool haBull1=(m1_haC1>m1_haO1); double m5_o1=iOpen(NULL,PERIOD_M5,1), m5_h1=iHigh(NULL,PERIOD_M5,1), m5_l1=iLow(NULL,PERIOD_M5,1), m5_c1=iClose(NULL,PERIOD_M5,1); double m5_o2=iOpen(NULL,PERIOD_M5,2), m5_c2=iClose(NULL,PERIOD_M5,2), m5_o3=iOpen(NULL,PERIOD_M5,3), m5_c3=iClose(NULL,PERIOD_M5,3); double m5_haC1=(m5_o1+m5_h1+m5_l1+m5_c1)/4.0, m5_haC2=(m5_o2+m5_h1+m5_l1+m5_c2)/4.0; double m5_haO2_apx=(m5_o3+m5_c3)/2.0, m5_haO1=(m5_haO2_apx+m5_haC2)/2.0; bool haBull5=(m5_haC1>m5_haO1); if(haBull1 && haBull5) green+=10; else if(!haBull1 && !haBull5) red+=10; else if(haBull1 && !haBull5){ green+=7; red+=3; } else if(!haBull1 && haBull5){ red+=7; green+=3; } // S/R bool jpy=(StringFind(Symbol(),"JPY")>=0); double pip=jpy?0.01:0.0001; double sup=Low[iLowest(NULL,PERIOD_M1,MODE_LOW,20,2)], res=High[iHighest(NULL,PERIOD_M1,MODE_HIGH,20,2)]; if(Close[1]>res-3*pip) red+=8; if(Close[1]0 && (g_nearestRes-Close[0])<6*pip) red+=5; if(g_nearestSup>0 && (Close[0]-g_nearestSup)<6*pip) green+=5; double diff=MathMax(-100.0, MathMin(100.0, green-red)); gP=MathMax(8.0, MathMin(92.0, 50.0+diff*0.7)); rP=100.0-gP; double dom=MathMax(gP,rP); if(dom>=85){ reason=(gP>rP)?"STRONG GREEN":"STRONG RED"; pC=(gP>rP)?NEON_GREEN:NEON_RED; } else if(dom>=75){ reason=(gP>rP)?"GREEN":"RED"; pC=(gP>rP)?NEON_GREEN:NEON_RED; } else if(dom>=62){ reason=(gP>rP)?"WEAK GREEN":"WEAK RED"; pC=(gP>rP)?NEON_CYAN:NEON_ORANGE; } else { reason="WAIT"; pC=NEON_YELLOW; } } //+------------------------------------------------------------------+ //| VOLUME TRAP, ULTIMATE TRAP, BROKER FORCE | //+------------------------------------------------------------------+ double VolumeTrapScore() { if(Bars<50) return 0; double cur=Close[0], hi=High[iHighest(NULL,0,MODE_HIGH,50,1)], lo=Low[iLowest(NULL,0,MODE_LOW,50,1)]; double rg=hi-lo; if(rg<=0) return 0; int zn=5; double zs=rg/zn; double vz[5]={0,0,0,0,0}; int zc[5]={0,0,0,0,0}; for(int i=1;i<=50;i++) { double p=Close[i]; int z=(int)((p-lo)/zs); if(z<0) z=0; if(z>=zn) z=zn-1; vz[z]+=Volume[i]; zc[z]++; } for(int z=0;z0) vz[z]/=zc[z]; int cz=(int)((cur-lo)/zs); if(cz<0) cz=0; if(cz>=zn) cz=zn-1; double vr=(double)Volume[1]/(vz[cz]+0.001); double wr=(High[1]-MathMax(Open[1],Close[1])+MathMin(Open[1],Close[1])-Low[1])/(High[1]-Low[1]); if(vr>2.0 && wr>0.65) return 25; if(vr>1.8 && wr>0.55) return 15; return 0; } double UltimateTrapScore() { double wr=(High[1]-MathMax(Open[1],Close[1])+MathMin(Open[1],Close[1])-Low[1])/(High[1]-Low[1]); double v1=(double)iVolume(NULL,PERIOD_M1,1), v2=(double)iVolume(NULL,PERIOD_M1,2); double avg=v2>0?v2:1.0, vr=v1/avg, rsi=iRSI(NULL,PERIOD_M1,14,PRICE_CLOSE,1), sc=0.0; if(wr>0.65) sc+=40; if(vr>2.0) sc+=30; if(rsi>75||rsi<25) sc+=20; if((High[1]>g_nearestRes && Close[1]g_nearestSup)) sc+=25; sc+=VolumeTrapScore(); return MathMin(100.0,sc); } bool IsBrokerForce() { int sd=0; for(int i=1;i<=3;i++){ if(Close[i]>Open[i]) sd++; else sd--; } double v1=(double)iVolume(NULL,PERIOD_M1,1), v2=(double)iVolume(NULL,PERIOD_M1,2); double sp=(double)MarketInfo(Symbol(),MODE_SPREAD); return (MathAbs(sd)==3 && v1>v2*2.0 && sp>6); } //+------------------------------------------------------------------+ //| STRATEGY DETECTION (for compatibility) | //+------------------------------------------------------------------+ string DetectMyStrategy() { int cc=g_otcCallPct, cp=g_otcPutPct, thr=(int)CROWD_THRESHOLD; if(cc>=thr && g_haM1=="HA BEARISH 1") { g_strategyType="TRAP"; g_strategySignal="PUT"; g_strategyReason="CALL "+IntegerToString(cc)+"% + HA RED"; return "PUT"; } if(cp>=thr && g_haM1=="HA BULLISH 1") { g_strategyType="TRAP"; g_strategySignal="CALL"; g_strategyReason="PUT "+IntegerToString(cp)+"% + HA GREEN"; return "CALL"; } if(cc>=thr && g_haM1=="HA BULLISH 1") { g_strategyType="TREND"; g_strategySignal="CALL"; g_strategyReason="CALL "+IntegerToString(cc)+"% + HA GREEN"; return "CALL"; } if(cp>=thr && g_haM1=="HA BEARISH 1") { g_strategyType="TREND"; g_strategySignal="PUT"; g_strategyReason="PUT "+IntegerToString(cp)+"% + HA RED"; return "PUT"; } g_strategyType="NONE"; g_strategySignal="WAIT"; g_strategyReason="Wait "+IntegerToString(thr)+"% + HA"; return "WAIT"; } //+------------------------------------------------------------------+ //| HRN (Hidden Round Number) – Candle close based | //+------------------------------------------------------------------+ void ScanHRNLevels() { g_rejCnt=0; bool jpy=(StringFind(Symbol(),"JPY")>=0); double pip=jpy?0.01:0.0001; double cur=Close[0]; for(int i=1;i<=LOOKBACK&&irg*0.35 && MathAbs(High[i]-cur)<=40*pip) { bool f=false; for(int k=0;krg*0.35 && MathAbs(Low[i]-cur)<=40*pip) { bool f=false; for(int k=0;k=0); double pip=jpy?0.01:0.0001; double step10=10*pip, step50=50*pip, step100=100*pip; double best=MathRound(curPrice/step10)*step10; double bestScore=-1; // Round numbers double candidates[6]; candidates[0]=MathRound(curPrice/step100)*step100; candidates[1]=candidates[0]+step100; candidates[2]=MathRound(curPrice/step50)*step50; candidates[3]=candidates[2]+step50; candidates[4]=MathRound(curPrice/step10)*step10; candidates[5]=candidates[4]+step10; for(int c=0;c<6;c++) { double lv=candidates[c]; double dist=MathAbs(curPrice-lv); if(dist>30*pip) continue; double score=100.0/(dist/pip+1); if(c<2) score*=2; else if(c<4) score*=1.5; if(score>bestScore){ bestScore=score; best=lv; } } // Wick rejections for(int k=0;k30*pip) continue; double score=g_rej[k].touches*15.0/(dist/pip+1); if(score>bestScore){ bestScore=score; best=lv; } } return best; } void UpdateHRN() { if(Time[0]!=g_hrnScanBar){ ScanHRNLevels(); g_hrnScanBar=Time[0]; } bool jpy=(StringFind(Symbol(),"JPY")>=0); double pip=jpy?0.01:0.0001; double cur=Close[0]; if(g_hrnPrice==0){ g_hrnPrice=FindBestHRN(cur); g_hrnIsSup=(cur>g_hrnPrice); g_hrnBreakBars=0; g_hrnLastCandle=Time[1]; return; } datetime lastClosed=Time[1]; if(lastClosed!=g_hrnLastCandle){ g_hrnLastCandle=lastClosed; double closedPrice=Close[1]; bool closedAbove=(closedPrice>g_hrnPrice+2*pip); bool closedBelow=(closedPrice=2){ double newLevel=FindBestHRN(cur); if(MathAbs(newLevel-g_hrnPrice)>3*pip){ g_hrnPrice=newLevel; g_hrnIsSup=(cur>g_hrnPrice); g_hrnBreakBars=0; } } } else { g_hrnBreakBars=0; } } DrawHLine(PFX+"HRN_LINE", g_hrnPrice, NEON_PINK, 2, STYLE_SOLID); string ln=PFX+"HRN_LBL"; SafeDel(ln); ObjectCreate(0,ln,OBJ_TEXT,0,Time[0]+Period()*60*2, g_hrnPrice); string lbl="HRN "+(g_hrnIsSup?"SUP":"RES")+" "+DoubleToString(g_hrnPrice,(int)MarketInfo(Symbol(),MODE_DIGITS)); if(g_hrnBreakBars>0) lbl+=" [BRK "+IntegerToString(g_hrnBreakBars)+"/2]"; ObjectSetText(ln,lbl,9,"Arial Bold",NEON_PINK); } //+------------------------------------------------------------------+ //| S/R LEVELS | //+------------------------------------------------------------------+ void AddRes(double lv){ if(lv<=0) return; for(int i=0;i=MAX_LEVELS){ for(int i=0;i=MAX_LEVELS){ for(int i=0;icur && (g_resLevels[i]-cur)0 && !IsLineNearby(g_nearestRes,5.0)) DrawHLine(PFX+"NEAREST_RES",g_nearestRes,NEON_RED,2,STYLE_SOLID); if(g_nearestSup>0 && !IsLineNearby(g_nearestSup,5.0)) DrawHLine(PFX+"NEAREST_SUP",g_nearestSup,NEON_GREEN,2,STYLE_SOLID); } void CheckBRK() { double pC=Close[1], pO=Open[1]; g_brkStr="NO BRK"; g_brkColor=CGR; if(g_nearestRes>0 && pC>g_nearestRes && pO<=g_nearestRes){ g_brkStr="BRK UP!"; g_brkColor=NEON_GREEN; } else if(g_nearestSup>0 && pC=g_nearestSup){ g_brkStr="BRK DOWN!"; g_brkColor=NEON_RED; } } void UpdateSR() { if(Time[0]==g_lastSRBar) return; g_lastSRBar=Time[0]; if(Bars<15) return; double nR=High[iHighest(NULL,PERIOD_M1,MODE_HIGH,10,1)], nS=Low[iLowest(NULL,PERIOD_M1,MODE_LOW,10,1)], cur=Close[0]; if(nR>0 && cur0 && cur>nS+5*Point) AddSup(nS); if(g_resCnt<1) AddRes(High[1]); if(g_supCnt<1) AddSup(Low[1]); DrawNearestSR(); CheckBRK(); } //+------------------------------------------------------------------+ //| COMMON POINTS & WICK REJECTIONS | //+------------------------------------------------------------------+ void DetectCommonPoints() { if(!SHOW_COMMON_POINTS){ g_commonCount=0; return; } if(Time[0]==g_lastCommonScan) return; g_lastCommonScan=Time[0]; g_commonCount=0; datetime nowBar=Time[0]; int periodSec=PeriodSeconds(PERIOD_M1); double m5h=iHigh(NULL,PERIOD_M5,iHighest(NULL,PERIOD_M5,MODE_HIGH,10,1)); double m5l=iLow(NULL,PERIOD_M5,iLowest(NULL,PERIOD_M5,MODE_LOW,10,1)); if(m5l>0 && g_commonCount0 && g_hrnIsSup && g_commonCount0 && g_commonCount0 && !g_hrnIsSup && g_commonCount=0;i--) if(TimeCurrent()>g_commonExpire[i]){ for(int j=i;jg_commonExpire[i]) continue; if(IsLineNearby(g_commonPrice[i],8.0)) continue; string id=PFX+"COMMON_"+IntegerToString(i), idL=PFX+"COMMON_L_"+IntegerToString(i); color zc=DARK_BLUE_NEON; ObjectCreate(0,id,OBJ_HLINE,0,0,g_commonPrice[i]); ObjectSetInteger(0,id,OBJPROP_COLOR,zc); ObjectSetInteger(0,id,OBJPROP_WIDTH,2); ObjectSetInteger(0,id,OBJPROP_STYLE,STYLE_DOT); string lbl=(g_commonType[i]=="CALL")?"^ CALL ZONE":"v PUT ZONE"; ObjectCreate(0,idL,OBJ_TEXT,0,Time[0]+PeriodSeconds(PERIOD_M1)*3,g_commonPrice[i]); ObjectSetText(idL,lbl,8,"Arial Bold",zc); } } void DetectWickRejections() { g_isSideways = (iADX(NULL,PERIOD_M1,14,PRICE_CLOSE,MODE_MAIN,1)<25); if(!SHOW_WICK_REJECTIONS){ g_wickLineCount=0; return; } if(Time[0]==g_lastWickScan) return; g_lastWickScan=Time[0]; bool jpy=(StringFind(Symbol(),"JPY")>=0); double pip=jpy?0.01:0.0001; double zone=15*pip; double cur=Close[0]; g_wickLineCount=0; datetime now=Time[0], expT=now+PeriodSeconds(PERIOD_M1)*120; for(int i=1;i<=40&&irg*0.30 && MathAbs(High[i]-cur)rg*0.30 && MathAbs(Low[i]-cur)=0;i--) if(TimeCurrent()>g_wickLineExpire[i]){ for(int j=i;jg_wickLineExpire[i]) continue; string id=PFX+"WICK_"+IntegerToString(i), idL=PFX+"WICK_L_"+IntegerToString(i); color lc=C'0,180,255'; ObjectCreate(0,id,OBJ_HLINE,0,0,g_wickLinePrice[i]); ObjectSetInteger(0,id,OBJPROP_COLOR,lc); ObjectSetInteger(0,id,OBJPROP_WIDTH,1); ObjectSetInteger(0,id,OBJPROP_STYLE,STYLE_DOT); string lbl="W"+IntegerToString(g_wickLineTouches[i])+"x"; ObjectCreate(0,idL,OBJ_TEXT,0,Time[0]+PeriodSeconds(PERIOD_M1)*2,g_wickLinePrice[i]); ObjectSetText(idL,lbl,8,"Arial Bold",lc); } } //+------------------------------------------------------------------+ //| HTF HIDDEN LEVELS | //+------------------------------------------------------------------+ bool IsSwingHigh(ENUM_TIMEFRAMES tf, int p, int lb) { double h=iHigh(NULL,tf,p); for(int i=1;i<=lb;i++){ if(p-i<0 || p+i>=iBars(NULL,tf)) return false; if(iHigh(NULL,tf,p-i)>=h || iHigh(NULL,tf,p+i)>=h) return false; } return true; } bool IsSwingLow(ENUM_TIMEFRAMES tf, int p, int lb) { double l=iLow(NULL,tf,p); for(int i=1;i<=lb;i++){ if(p-i<0 || p+i>=iBars(NULL,tf)) return false; if(iLow(NULL,tf,p-i)<=l || iLow(NULL,tf,p+i)<=l) return false; } return true; } void AddHTFLevel(double price, string tf, string type, datetime time, int strength, bool isRound) { if(g_htfLevelCount>=MAX_HTF_LEVELS) return; bool jpy=(StringFind(Symbol(),"JPY")>=0); double pip=jpy?0.01:0.0001; for(int i=0;i=0); double pip=jpy?0.01:0.0001; double curP=Close[0]; double rU=MathCeil(curP/(10*pip))*(10*pip), rD=MathFloor(curP/(10*pip))*(10*pip); if(MathAbs(curP-rU)/pip<=15) AddHTFLevel(rU,"ROUND","RESISTANCE",TimeCurrent(),8,true); if(MathAbs(curP-rD)/pip<=15) AddHTFLevel(rD,"ROUND","SUPPORT",TimeCurrent(),8,true); // M5, M15, M30, H1 if(iBars(NULL,PERIOD_M5)>=30) { for(int i=2;i<30;i++){ if(IsSwingHigh(PERIOD_M5,i,2)) AddHTFLevel(iHigh(NULL,PERIOD_M5,i),"M5","RESISTANCE",iTime(NULL,PERIOD_M5,i),5,false); if(IsSwingLow(PERIOD_M5,i,2)) AddHTFLevel(iLow(NULL,PERIOD_M5,i),"M5","SUPPORT",iTime(NULL,PERIOD_M5,i),5,false); } } if(iBars(NULL,PERIOD_M15)>=20) { for(int i=2;i<20;i++){ if(IsSwingHigh(PERIOD_M15,i,2)) AddHTFLevel(iHigh(NULL,PERIOD_M15,i),"M15","RESISTANCE",iTime(NULL,PERIOD_M15,i),7,false); if(IsSwingLow(PERIOD_M15,i,2)) AddHTFLevel(iLow(NULL,PERIOD_M15,i),"M15","SUPPORT",iTime(NULL,PERIOD_M15,i),7,false); } } if(iBars(NULL,PERIOD_M30)>=15) { for(int i=2;i<15;i++){ if(IsSwingHigh(PERIOD_M30,i,2)) AddHTFLevel(iHigh(NULL,PERIOD_M30,i),"M30","RESISTANCE",iTime(NULL,PERIOD_M30,i),9,false); if(IsSwingLow(PERIOD_M30,i,2)) AddHTFLevel(iLow(NULL,PERIOD_M30,i),"M30","SUPPORT",iTime(NULL,PERIOD_M30,i),9,false); } } if(iBars(NULL,PERIOD_H1)>=10) { for(int i=2;i<10;i++){ if(IsSwingHigh(PERIOD_H1,i,2)) AddHTFLevel(iHigh(NULL,PERIOD_H1,i),"H1","RESISTANCE",iTime(NULL,PERIOD_H1,i),12,false); if(IsSwingLow(PERIOD_H1,i,2)) AddHTFLevel(iLow(NULL,PERIOD_H1,i),"H1","SUPPORT",iTime(NULL,PERIOD_H1,i),12,false); } } // Sort by strength for(int i=0;i=0); double pip=jpy?0.01:0.0001; if(MathAbs(Close[0]-g_htfLevels[i].price)/pip>40) continue; if(IsLineNearby(g_htfLevels[i].price,5.0)) continue; string nm=PFX+"HTF_"+IntegerToString(drawn); color lc=g_htfLevels[i].isRound?NEON_PURPLE:(g_htfLevels[i].type=="SUPPORT"?NEON_GREEN:NEON_RED); ObjectCreate(0,nm,OBJ_HLINE,0,0,g_htfLevels[i].price); ObjectSetInteger(0,nm,OBJPROP_COLOR,lc); ObjectSetInteger(0,nm,OBJPROP_WIDTH,1); ObjectSetInteger(0,nm,OBJPROP_STYLE,STYLE_DOT); string lbl=StringFormat("%s %s",g_htfLevels[i].timeframe,g_htfLevels[i].type); ObjectCreate(0,nm+"_L",OBJ_TEXT,0,Time[0]+Period()*60*3,g_htfLevels[i].price); ObjectSetText(nm+"_L",lbl,8,"Arial",lc); drawn++; } } //+------------------------------------------------------------------+ //| QMR PATTERN | //+------------------------------------------------------------------+ int DetectQMR() { if(Bars<40) return 0; bool jpy=(StringFind(Symbol(),"JPY")>=0); double pip=jpy?0.01:0.0001; double sH[10],sL[10]; int sHB[10],sLB[10]; int hC=0,lC=0; for(int i=3;i<40&&hC<10;i++) if(High[i]>High[i-1]&&High[i]>High[i-2]&&High[i]>High[i+1]&&High[i]>High[i+2]){ sH[hC]=High[i]; sHB[hC]=i; hC++; } for(int i=3;i<40&&lC<10;i++) if(Low[i]=sH[iA]-10*pip) continue; for(int iB=0;iB=sL[iB]) continue; bool m3=false,m5=false; if(Bars>=8){ double o1=Open[3],c1=Close[3],o2=Open[0],c2=Close[0]; double b1=MathAbs(c1-o1); if(c2>o2 && c1b1*0.5) m3=true; } if(iBars(NULL,PERIOD_M5)>=3){ double o1=iOpen(NULL,PERIOD_M5,2),c1=iClose(NULL,PERIOD_M5,2),o2=iOpen(NULL,PERIOD_M5,1),c2=iClose(NULL,PERIOD_M5,1); double b1=MathAbs(c1-o1); if(c2>o2 && c1b1*0.5) m5=true; } if(m3||m5) if(Close[0]>sL[iD] && Close[0]=sH[iB]) continue; bool m3=false,m5=false; if(Bars>=8){ double o1=Open[3],c1=Close[3],o2=Open[0],c2=Close[0]; double b1=MathAbs(c1-o1); if(c2o1 && MathAbs(c2-o2)>b1*0.5) m3=true; } if(iBars(NULL,PERIOD_M5)>=3){ double o1=iOpen(NULL,PERIOD_M5,2),c1=iClose(NULL,PERIOD_M5,2),o2=iOpen(NULL,PERIOD_M5,1),c2=iClose(NULL,PERIOD_M5,1); double b1=MathAbs(c1-o1); if(c2o1 && MathAbs(c2-o2)>b1*0.5) m5=true; } if(m3||m5) if(Close[0]sL[iC2]){ qmrA=sL[iA]; qmrB=sH[iB]; qmrC=sL[iC2]; qmrD=sH[iD]; qmrActive=true; qmrExpire=TimeCurrent()+900; return -1; }}}} return 0; } //+------------------------------------------------------------------+ //| OTHER SIGNALS (RSI Divergence, Streak, Classic Patterns) | //+------------------------------------------------------------------+ int DetectRSIDivergence() { if(Bars<30) return 0; double rN=iRSI(NULL,PERIOD_M1,14,PRICE_CLOSE,1), rP=iRSI(NULL,PERIOD_M1,14,PRICE_CLOSE,8); double lN=Low[iLowest(NULL,PERIOD_M1,MODE_LOW,5,1)], lPv=Low[iLowest(NULL,PERIOD_M1,MODE_LOW,5,6)]; if(lNrP && rN<40) return 1; double hN=High[iHighest(NULL,PERIOD_M1,MODE_HIGH,5,1)], hPv=High[iHighest(NULL,PERIOD_M1,MODE_HIGH,5,6)]; if(hN>hPv && rN60) return -1; return 0; } int StreakReversalSignal() { if(Bars<15) return 0; int g=0,r=0; for(int i=1;iOpen[i]){ if(r>0) break; g++; } else if(Close[i]0) break; r++; } else break; } if(g>=4) return -1; if(r>=4) return 1; return 0; } int DetectClassicPatterns() { if(Bars<30) return 0; bool jpy=(StringFind(Symbol(),"JPY")>=0); double pip=jpy?0.01:0.0001; double tol=8.0*pip; double sh[2],sl[2]; int shB[2],slB[2]; int shC=0,slC=0; for(int i=2;i<25&&(shC<2||slC<2);i++){ if(High[i]>High[i-1]&&High[i]>High[i-2]&&High[i]>High[i+1]&&High[i]>High[i+2]){ if(shC<2){ sh[shC]=High[i]; shB[shC]=i; shC++; } } if(Low[i]=2){ int bd=MathAbs(shB[0]-shB[1]); if(bd>=5 && MathAbs(sh[0]-sh[1])<=tol){ int bn=MathMin(shB[0],shB[1]), bx=MathMax(shB[0],shB[1]); double vl=Low[iLowest(NULL,PERIOD_M1,MODE_LOW,bx-bn+1,bn)]; if(Close[0]=2){ int bd=MathAbs(slB[0]-slB[1]); if(bd>=5 && MathAbs(sl[0]-sl[1])<=tol){ int bn=MathMin(slB[0],slB[1]), bx=MathMax(slB[0],slB[1]); double ph=High[iHighest(NULL,PERIOD_M1,MODE_HIGH,bx-bn+1,bn)]; if(Close[0]>ph) return 1; else if(Close[0]>MathMax(sl[0],sl[1])) return 1; } } return 0; } //+------------------------------------------------------------------+ //| ACCURACY TRACKING | //+------------------------------------------------------------------+ void UpdateAccuracy() { if(Bars<5||Time[0]==g_accLastBar) return; g_accLastBar=Time[0]; if(g_lastPredBar==Time[1] && MathAbs(g_lastPredGreen-50.0)>10.0){ bool aG=(Close[1]>Open[1]), pG=(g_lastPredGreen>50.0), win=(aG==pG); if(win){ g_accCorrect++; g_lossStreak=0; } else g_lossStreak++; g_accTotal++; if(g_accTotal>50){ double oldRate=g_accuracy/100.0; g_accCorrect=(int)(oldRate*49); g_accTotal=50; if(win) g_accCorrect++; } if(g_accTotal>0) g_accuracy=MathMax(40.0,MathMin(90.0,(double)g_accCorrect/g_accTotal*100.0)); } g_lastPredGreen = (USE_NEW_PREDICTION ? (g_otc_call_pct > 50 ? g_otc_call_pct : 100-g_otc_put_pct) : 50); // placeholder g_lastPredBar=Time[0]; } //+------------------------------------------------------------------+ //| OTHER PAIRS SCAN | //+------------------------------------------------------------------+ void ScanOtherPairs() { g_pairCount=0; string fn="OTC_Signals_Master.txt"; string cur=Symbol(); int h=FileOpen(fn,FILE_READ|FILE_TXT|FILE_SHARE_READ); if(h==INVALID_HANDLE) return; datetime now=TimeCurrent(); while(!FileIsEnding(h) && g_pairCount<5){ string ln=FileReadString(h); if(StringLen(ln)<15) continue; int p1=StringFind(ln,"|"), p2=StringFind(ln,"|",p1+1), p3=StringFind(ln,"|",p2+1), p4=StringFind(ln,"|",p3+1); if(p1<0||p2<0||p3<0||p4<0) continue; string pair=StringSubstr(ln,0,p1); if(pair==cur) continue; string sig=StringSubstr(ln,p1+1,p2-p1-1); double conf=StringToDouble(StringSubstr(ln,p2+1,p3-p2-1)); int ex=(int)StringToInteger(StringSubstr(ln,p4+1)); if(confENTRY_MAX_SEC){ g_finalSignal="WAIT"; g_finalColor=NEON_GRAY; return; } if(ENABLE_SPIKE_FILTER && IsBigCandle(1)){ g_finalSignal="WAIT"; g_finalColor=NEON_ORANGE; g_filterStatus="SPIKE BLOCK"; return; } double volSpike=GetVolumeSpike(); bool crowdCallExtreme=(g_otcCallPct>=CROWD_THRESHOLD); bool crowdPutExtreme=(g_otcPutPct>=CROWD_THRESHOLD); bool highVolume=(volSpike>=VOLUME_SPIKE_RATIO); if(crowdCallExtreme && highVolume){ g_finalSignal="PUT"; g_finalColor=NEON_RED; } else if(crowdPutExtreme && highVolume){ g_finalSignal="CALL"; g_finalColor=NEON_GREEN; } else if(crowdCallExtreme){ g_finalSignal="WEAK PUT"; g_finalColor=NEON_ORANGE; } else if(crowdPutExtreme){ g_finalSignal="WEAK CALL"; g_finalColor=NEON_CYAN; } else { g_finalSignal="WAIT"; g_finalColor=NEON_YELLOW; } static string lastSig=""; if(g_finalSignal!="WAIT" && g_finalSignal!=lastSig){ lastSig=g_finalSignal; g_signalTime=TimeCurrent(); if(ENABLE_NOTIFY) SendNotification(StringFormat("%s %s (Crowd %d%% Vol %.1fx)", Symbol(), g_finalSignal, (g_finalSignal=="CALL"||g_finalSignal=="WEAK CALL")?g_otc_put_pct:g_otc_call_pct, volSpike)); } } //+------------------------------------------------------------------+ //| DRAWING HELPERS | //+------------------------------------------------------------------+ void SafeDel(string id){ if(ObjectFind(0,id)>=0) ObjectDelete(0,id); } void DrawHLine(string id, double price, color clr, int width, int style){ if(price<=0) return; SafeDel(id); ObjectCreate(0,id,OBJ_HLINE,0,0,price); ObjectSetInteger(0,id,OBJPROP_COLOR,clr); ObjectSetInteger(0,id,OBJPROP_WIDTH,width); ObjectSetInteger(0,id,OBJPROP_STYLE,style); } void Box(string id, int x, int y, int w, int h, color bg, color bd){ string n=PFX+id; if(ObjectFind(0,n)<0) ObjectCreate(0,n,OBJ_RECTANGLE_LABEL,0,0,0); ObjectSetInteger(0,n,OBJPROP_XDISTANCE,x); ObjectSetInteger(0,n,OBJPROP_YDISTANCE,y); ObjectSetInteger(0,n,OBJPROP_XSIZE,w); ObjectSetInteger(0,n,OBJPROP_YSIZE,h); ObjectSetInteger(0,n,OBJPROP_BGCOLOR,bg); ObjectSetInteger(0,n,OBJPROP_BORDER_TYPE,BORDER_FLAT); ObjectSetInteger(0,n,OBJPROP_COLOR,bd); } void Text(string id, int x, int y, string txt, color cl, int fs, bool bold){ string n=PFX+id; if(ObjectFind(0,n)<0) ObjectCreate(0,n,OBJ_LABEL,0,0,0); ObjectSetInteger(0,n,OBJPROP_XDISTANCE,x); ObjectSetInteger(0,n,OBJPROP_YDISTANCE,y); ObjectSetText(n,txt,fs,bold?"Arial Bold":"Arial",cl); } void NeonBar(string id, int x, int y, int w, int h, double pct, color fc){ Box(id+"_bg",x,y,w,h,BG_DARK4,BG_DARK4); int fw=(int)(pct/100.0*w); if(fw<4) fw=4; if(fw>w) fw=w; Box(id+"_f",x,y,fw,h,fc,fc); } void Cube(string id, int x, int y, int w, int h, color bc, color bg, string lbl, color lc, string val, color vc, int vfs){ Box(id,x,y,w,h,bg,bc); if(StringLen(lbl)>0) Text(id+"_l",x+10,y+6,lbl,lc,10,true); if(StringLen(val)>0) Text(id+"_v",x+10,y+36,val,vc,vfs,true); } //+------------------------------------------------------------------+ //| DASHBOARD DRAW | //+------------------------------------------------------------------+ void DrawDashboard() { for(int i=ObjectsTotal()-1;i>=0;i--){ string nm=ObjectName(i); if(StringFind(nm,PFX)==0) ObjectDelete(nm); } int W=DASHBOARD_WIDTH, G=8, CW=(W-2*G)/3, CH=100, cx=DASHBOARD_X+G, yy=DASHBOARD_Y; // ROW 1 Cube("c1",cx,yy,CW,CH,NEON_CYAN,BG_DARK2,"PAIR",NEON_CYAN,Symbol(),NEON_BLUE,13); Cube("c2",cx+CW+G,yy,CW,CH,g_final_color,BG_DARK2,"SIGNAL",NEON_CYAN,g_finalSignal,g_final_color,14); double greenPred, redPred; string predAct; color predColor; if(USE_NEW_PREDICTION) CalcNextCandlePrediction(greenPred, redPred, predAct, predColor); else CalcAdvancedPrediction(greenPred, redPred, predAct, predColor); Box("c_pred",cx+2*(CW+G),yy,CW,CH,BG_DARK2,predColor); Text("c_pred_l",cx+2*(CW+G)+10,yy+5,"NEXT CANDLE",NEON_CYAN,9,true); int bW=CW-20, gBW=(int)(greenPred/100.0*bW), rBW=(int)(redPred/100.0*bW); if(gBW<3)gBW=3; if(rBW<3)rBW=3; Box("c_pred_gbg",cx+2*(CW+G)+10,yy+22,bW,6,BG_DARK4,BG_DARK4); Box("c_pred_gfg",cx+2*(CW+G)+10,yy+22,gBW,6,NEON_GREEN,NEON_GREEN); Text("c_pred_gp",cx+2*(CW+G)+10,yy+30,"G:"+DoubleToString(greenPred,0)+"%",NEON_GREEN,9,true); Box("c_pred_rbg",cx+2*(CW+G)+10,yy+44,bW,6,BG_DARK4,BG_DARK4); Box("c_pred_rfg",cx+2*(CW+G)+10,yy+44,rBW,6,NEON_RED,NEON_RED); Text("c_pred_rp",cx+2*(CW+G)+10,yy+52,"R:"+DoubleToString(redPred,0)+"%",NEON_RED,9,true); Text("c_pred_a",cx+2*(CW+G)+10,yy+68,predAct,predColor,9,true); NeonBar("c_pred_b",cx+2*(CW+G)+10,yy+86,bW,6,MathMax(greenPred,redPred),predColor); yy+=CH+G; // ROW 2 int cp=0; g_brain=BrainSc(cp); Cube("c4",cx,yy,CW,CH,NEON_CYAN,BG_DARK3,"BRAIN",NEON_CYAN,(g_brain>=0?"+":"")+DoubleToString(g_brain,1),(g_brain>0)?NEON_GREEN:NEON_RED,16); Cube("c5",cx+CW+G,yy,CW,CH,NEON_CYAN,BG_DARK3,"SPM",NEON_CYAN,(g_spm>=0?"+":"")+DoubleToString(g_spm,1),(g_spm>0)?NEON_GREEN:NEON_RED,16); color sClr; string sName=GetCurrentSession(sClr); bool isAct=IsSessionActive(); Box("c_ses",cx+2*(CW+G),yy,CW,CH,BG_DARK2,sClr); Text("c_ses_l",cx+2*(CW+G)+10,yy+5,"SESSION",NEON_CYAN,9,true); Text("c_ses_v",cx+2*(CW+G)+10,yy+24,sName,sClr,13,true); int gH=TimeHour(TimeGMT()), gM=TimeMinute(TimeGMT()); Text("c_ses_t",cx+2*(CW+G)+10,yy+50,"GMT "+(gH<10?"0":"")+IntegerToString(gH)+":"+(gM<10?"0":"")+IntegerToString(gM),NEON_WHITE,10,false); Text("c_ses_s",cx+2*(CW+G)+10,yy+70,isAct?"ACTIVE":"LOW VOL",isAct?NEON_GREEN:NEON_ORANGE,9,true); yy+=CH+G; // ROW 3 g_neural=NeuralBiasFast(); Cube("c7",cx,yy,CW,CH,NEON_CYAN,BG_DARK2,"NEURAL AI",NEON_CYAN,DoubleToString(g_neural,1)+"%",(g_neural>72)?NEON_ORANGE:(g_neural<35)?NEON_CYAN:NEON_GREEN,15); NeonBar("c7b",cx+12,yy+82,CW-24,6,g_neural,(g_neural>72)?NEON_ORANGE:(g_neural<35)?NEON_CYAN:NEON_GREEN); Box("c8",cx+CW+G,yy,CW,CH,BG_DARK2,NEON_CYAN); Text("c8_l",cx+CW+G+10,yy+5,"CROWD",NEON_CYAN,9,true); Text("c8_c",cx+CW+G+10,yy+24,"CALL "+IntegerToString(g_otcCallPct)+"%",NEON_RED,12,true); Text("c8_p",cx+CW+G+10,yy+46,"PUT "+IntegerToString(g_otcPutPct)+"%",NEON_GREEN,12,true); Text("c8_b",cx+CW+G+10,yy+70,"OTC Crowd",NEON_GOLD,9,false); string ms=DetectMyStrategy(); color stratC=(g_strategyType=="TRAP")?NEON_PURPLE:(g_strategyType=="TREND")?NEON_GREEN:CGR; string stratLabel=(g_strategyType=="TRAP")?"TRAP "+ms:(g_strategyType=="TREND")?"TREND "+ms:"NO STRATEGY"; Cube("c_strat",cx+2*(CW+G),yy,CW,CH,stratC,BG_DARK3,"STRATEGY",NEON_CYAN,stratLabel,stratC,11); yy+=CH+G; // ROW 4 g_microAI=CalcMicroAI(); color maC; if(g_microAI>72){maC=NEON_ORANGE;} else if(g_microAI>55){maC=NEON_YELLOW;} else if(g_microAI>45){maC=NEON_CYAN;} else{maC=NEON_GREEN;} Cube("c_mai",cx,yy,CW,CH,maC,BG_DARK2,"MICRO AI",NEON_CYAN,DoubleToString(g_microAI,0)+"%",maC,16); NeonBar("c_mai_b",cx+12,yy+82,CW-24,6,g_microAI,maC); g_microTrap=CalcMicroTrap(); color mtsC=(g_microTrap>=90)?NEON_PURPLE:(g_microTrap>=75)?NEON_RED:(g_microTrap>=50)?NEON_ORANGE:NEON_GREEN; Cube("c_mts",cx+CW+G,yy,CW,CH,mtsC,BG_DARK2,"MICRO TRAP",NEON_CYAN,"SCORE "+IntegerToString(g_microTrap),mtsC,13); NeonBar("c_mts_b",cx+CW+G+12,yy+82,CW-24,6,MathMin(100,g_microTrap),mtsC); double tfaScore=CalcTFA(g_tfaDetail); int tfaInt=(int)tfaScore; color tfaColor; string tfaLabel; if(tfaInt>=5){tfaLabel="STRONG";tfaColor=NEON_GREEN;} else if(tfaInt>=4){tfaLabel="GOOD";tfaColor=NEON_LIME;} else if(tfaInt>=3){tfaLabel="MEDIUM";tfaColor=NEON_YELLOW;} else if(tfaInt>=2){tfaLabel="WEAK";tfaColor=NEON_ORANGE;} else{tfaLabel="POOR";tfaColor=C'100,100,120';} color tfaBC=tfaColor; string dirTxt=""; if(g_haM1=="HA BEARISH 1"){tfaBC=NEON_RED; dirTxt=" [DOWN]";} else if(g_haM1=="HA BULLISH 1"){tfaBC=NEON_GREEN; dirTxt=" [UP]";} else{dirTxt=" [MIX]";} Box("c_tfa",cx+2*(CW+G),yy,CW,CH,BG_DARK3,tfaBC); Text("c_tfa_l",cx+2*(CW+G)+10,yy+5,"TFA SCORE",NEON_CYAN,9,true); Text("c_tfa_v",cx+2*(CW+G)+10,yy+24,IntegerToString(tfaInt)+"/6 "+tfaLabel+dirTxt,tfaBC,11,true); Text("c_tfa_d",cx+2*(CW+G)+10,yy+50,StringSubstr(g_tfaDetail,0,28),CGR,8,false); NeonBar("c_tfa_b",cx+2*(CW+G)+10,yy+82,CW-20,6,(double)tfaInt/6.0*100.0,tfaBC); yy+=CH+G; // ROW 5 g_fractal=CalcAdvancedFractal(); color frC=(g_fractal>=75)?NEON_RED:(g_fractal>=50)?NEON_ORANGE:(g_fractal>=25)?NEON_YELLOW:NEON_GREEN; string frT=(g_fractal>=75)?"TRAP ZONE!":(g_fractal>=50)?"WARNING":(g_fractal>=25)?"CAUTION":"CLEAR"; Cube("c_frc",cx,yy,CW,CH,frC,BG_DARK2,"FRACTAL",NEON_CYAN,frT,frC,11); NeonBar("c_frc_b",cx+12,yy+82,CW-24,6,g_fractal,frC); color biasClr; string biasStr=CalcMarketBias(biasClr,g_brain,g_spm); Box("c_bias",cx+CW+G,yy,CW,CH,BG_DARK2,biasClr); Text("c_bias_l",cx+CW+G+10,yy+5,"MARKET BIAS",NEON_CYAN,9,true); Text("c_bias_v",cx+CW+G+10,yy+24,biasStr,biasClr,12,true); Text("c_bias_m",cx+CW+G+10,yy+48,"MODE: "+g_marketMode,(g_marketMode=="TREND")?NEON_GREEN:(g_marketMode=="REVERSAL")?NEON_RED:NEON_YELLOW,9,false); color accC=(g_accuracy>=70)?NEON_GREEN:(g_accuracy>=60)?NEON_YELLOW:NEON_RED; Text("c_bias_a",cx+CW+G+10,yy+68,"ACC: "+DoubleToString(g_accuracy,1)+"%",accC,9,false); NeonBar("c_bias_b",cx+CW+G+10,yy+82,CW-20,6,g_accuracy,accC); int dg=(int)MarketInfo(Symbol(),MODE_DIGITS); if(dg<=0) dg=5; Box("c18",cx+2*(CW+G),yy,CW,CH,BG_DARK2,NEON_CYAN); Text("c18_l",cx+2*(CW+G)+10,yy+4,"S/R LEVELS",NEON_CYAN,9,true); Text("c18_r",cx+2*(CW+G)+10,yy+24,"R: "+(g_nearestRes>0?DoubleToString(g_nearestRes,dg):"--"),NEON_RED,12,true); Text("c18_s",cx+2*(CW+G)+10,yy+48,"S: "+(g_nearestSup>0?DoubleToString(g_nearestSup,dg):"--"),NEON_GREEN,12,true); Text("c18_b",cx+2*(CW+G)+10,yy+72,g_brkStr,g_brkColor,10,true); yy+=CH+G; // ROW 6 double wick=(High[1]-Low[1])>0?((High[1]-MathMax(Open[1],Close[1]))+(MathMin(Open[1],Close[1])-Low[1]))/(High[1]-Low[1]):0; color wickC=(wick>0.70)?NEON_RED:(wick>0.50)?NEON_ORANGE:NEON_GREEN; Box("c15",cx,yy,CW,CH,BG_DARK2,wickC); Text("c15_l",cx+10,yy+5,"WICKS",NEON_CYAN,9,true); Text("c15_v",cx+10,yy+24,DoubleToString(wick,2),wickC,16,true); Text("c15_b",cx+10,yy+52,(wick>0.70)?"KILL SHOT":(wick>0.50)?"HIGH":"LOW",wickC,10,false); NeonBar("c15_bar",cx+10,yy+82,CW-20,6,wick*100,wickC); Box("c_ha",cx+CW+G,yy,CW,CH,BG_DARK2,g_haM1Color); Text("c_ha_l",cx+CW+G+10,yy+5,"HA CANDLES",NEON_CYAN,9,true); Text("c_ha_m1",cx+CW+G+10,yy+26,"M1: "+g_haM1,g_haM1Color,11,true); Text("c_ha_m5",cx+CW+G+10,yy+48,"M5: "+g_haM5,g_haM5Color,11,true); string haComb=""; color haCombC=NEON_YELLOW; if(g_haM1=="HA BULLISH 1" && g_haM5=="HA BULLISH 5"){ haComb="BOTH BULL"; haCombC=NEON_GREEN; } else if(g_haM1=="HA BEARISH 1" && g_haM5=="HA BEARISH 5"){ haComb="BOTH BEAR"; haCombC=NEON_RED; } else haComb="MIXED"; Text("c_ha_c",cx+CW+G+10,yy+72,haComb,haCombC,10,true); string revReason=""; if(g_otcCallPct>=CROWD_THRESHOLD) revReason="BUYER TRAP"; else if(g_otcPutPct>=CROWD_THRESHOLD) revReason="SELLER TRAP"; else revReason="No reversal"; color revColor=(g_otcCallPct>=CROWD_THRESHOLD)?NEON_RED:(g_otcPutPct>=CROWD_THRESHOLD)?NEON_GREEN:NEON_YELLOW; Box("c_reason",cx+2*(CW+G),yy,CW,CH,BG_DARK2,revColor); Text("c_reason_l",cx+2*(CW+G)+10,yy+5,"REVERSAL",NEON_CYAN,9,true); Text("c_reason_v",cx+2*(CW+G)+10,yy+28,revReason,revColor,9,false); yy+=CH+G; // ROW 7 int bottomW=(W-2*G-2*G)/3, bottomH=110; yy+=5; int x1=cx; Box("c_hrn",x1,yy,bottomW,bottomH,BG_DARK2,NEON_PINK); Text("c_hrn_l",x1+8,yy+6,"HRN LEVEL",NEON_PINK,9,true); Text("c_hrn_v",x1+8,yy+28,DoubleToString(g_hrnPrice,dg),NEON_PINK,12,true); Text("c_hrn_t",x1+8,yy+54,g_hrnIsSup?"SUPPORT":"RESISTANCE",NEON_PINK,9,false); Text("c_hrn_b",x1+8,yy+76,"Brk "+IntegerToString(g_hrnBreakBars)+"/2",(g_hrnBreakBars>0)?NEON_ORANGE:NEON_PINK,8,false); Text("c_hrn_s",x1+8,yy+94,g_isSideways?"SIDEWAYS":"TRENDING",g_isSideways?NEON_YELLOW:NEON_GREEN,8,false); // Other pairs cube ScanOtherPairs(); int x2=x1+bottomW+G; Box("c_other",x2,yy,bottomW,bottomH,BG_DARK2,NEON_GOLD); Text("c_other_l",x2+10,yy+6,"OTHER PAIRS",NEON_CYAN,9,true); if(g_pairCount==0) Text("c_other_n",x2+10,yy+35,"No signals",CGR,9,false); else { int ly=30; for(int i=0;i=1.5)?"SPIKE":(volRatio<=0.7)?"FADE":"NORMAL"; color volColor=(volRatio>=1.5)?NEON_RED:(volRatio<=0.7)?CGR:NEON_CYAN; Box("c_quick",x2+bottomW+G,yy,bottomW,bottomH,BG_DARK2,NEON_LIME); Text("c_quick_l",x2+bottomW+G+10,yy+6,"OTC QUICK",NEON_CYAN,9,true); Text("c_quick_t",x2+bottomW+G+10,yy+28,"Time: "+IntegerToString(mm)+":"+(ss<10?"0":"")+IntegerToString(ss)+"s",NEON_GOLD,10,true); double spread=MarketInfo(Symbol(),MODE_SPREAD); color spC=(spread<=6)?NEON_GREEN:NEON_ORANGE; Text("c_quick_s",x2+bottomW+G+10,yy+48,"Spread: "+DoubleToString(spread,0),spC,9,true); Text("c_quick_v",x2+bottomW+G+10,yy+68,"Vol: "+DoubleToString(volRatio,1)+"x "+volStatus,volColor,10,true); string entryStatus = (age>=ENTRY_MIN_SEC && age<=ENTRY_MAX_SEC && rem>=LAST_SEC_BLOCK) ? "OPEN" : "CLOSED"; Text("c_quick_e",x2+bottomW+G+10,yy+88,entryStatus,entryStatus=="OPEN"?NEON_GREEN:NEON_RED,9,true); // Timer if(SHOW_TIMER){ string nm=PFX+"timer"; int ps=Period()*60; int el=(int)(TimeCurrent()-Time[0]); int remT=ps-el; if(remT<=0) remT=ps; datetime tt=Time[0]+ps+60; double tp=High[0]+(Point*15); ObjectDelete(0,nm); ObjectCreate(0,nm,OBJ_TEXT,0,tt,tp); ObjectSetText(nm,IntegerToString(remT)+"s",11,"Arial Bold",NEON_YELLOW); } } //+------------------------------------------------------------------+ //| ON TIMER | //+------------------------------------------------------------------+ void OnTimer() { if(Bars<50) return; static datetime last5min=0; if(Time[0]/300!=last5min/300){ DetectHiddenLevels(); last5min=Time[0]; } CalcHA(); CalcCrowd(); UpdateHRN(); UpdateSR(); DetectCommonPoints(); DetectWickRejections(); DrawCommonPoints(); DrawWickRejectLines(); DrawHiddenLevels(); DrawNearestSR(); UpdateAccuracy(); FinalSignalEngine(); g_marketMode = (MathAbs(g_brain)>2) ? "TREND" : "RANGE"; DrawDashboard(); ChartRedraw(); } //+------------------------------------------------------------------+ //| INIT | //+------------------------------------------------------------------+ int OnInit() { InitNW(); EventSetTimer(1); g_hrnPrice=0; g_resCnt=0; g_supCnt=0; g_commonCount=0; g_wickLineCount=0; g_htfLevelCount=0; Print("AIBRAIN OTC v46.0 FULL Loaded | Crowd ", CROWD_LOOKBACK, "c @ ", CROWD_THRESHOLD, "% | Volume Spike ", VOLUME_SPIKE_RATIO, "x"); return INIT_SUCCEEDED; } //+------------------------------------------------------------------+ //| DEINIT | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { EventKillTimer(); for(int i=ObjectsTotal()-1;i>=0;i--){ string nm=ObjectName(i); if(StringFind(nm,PFX)==0) ObjectDelete(nm); } } //+------------------------------------------------------------------+ //| ON CALCULATE | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { return rates_total; } //+------------------------------------------------------------------+