From ff8aa9fcfb4b62966fbe5509a4394f7390bf38f6 Mon Sep 17 00:00:00 2001 From: Pietro Giacobazzi Date: Wed, 17 Jun 2026 07:09:51 +0000 Subject: [PATCH] PaPP v2 indicatore: fallback robusto a TextGetSize per la larghezza del box Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- PaPP v2/PaPP_Median.mq5 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PaPP v2/PaPP_Median.mq5 b/PaPP v2/PaPP_Median.mq5 index 1b6f576..7b4b6cf 100644 --- a/PaPP v2/PaPP_Median.mq5 +++ b/PaPP v2/PaPP_Median.mq5 @@ -444,8 +444,11 @@ int OnCalculate(const int rates_total, int TxtW(string s,int fs,bool bold) { TextSetFont(bold?"Consolas Bold":"Consolas",-fs*10); - uint w=0,h=0; TextGetSize(s,w,h); - return (int)w; + uint w=0,h=0; + bool ok=TextGetSize(s,w,h); + int est=(int)MathCeil(StringLen(s)*fs*0.62); // fallback se TextGetSize non disponibile + if(!ok || (int)w<=0) return est; + return MathMax((int)w,est); // mai meno della stima } //+------------------------------------------------------------------+ void DrawInfo()