Enclosed may be of use to some...

 

Was just doing some one shot/hotKeyed Buy,Sell scripts with TrailStops and thot would be fun to see comment area 'objects' which changed in sympathy to open trade.

Was thinking how great to trim rightmost zero decimal digits. Unable to source it so...

After a bit came up with below.

Anyway... might be of use or give 'ideas' ;

.

//string dPrint (double d,bool bTR=false){return(iifs(bTR,sTrimRightZeros(d),DoubleToStr(d,Digits)));}
//
string sTrimRightZeros (double dVal)
{
  string s = dVal;
  int iDPofst = StringFind(s,".",0); 
  if(iDPofst==-1) return(dVal);                   //no can do. no DP

  int iCh = '0';                                  //init for first loop cond test
  for(int i=StringLen(s)-1;i>iDPofst && iCh=='0';i--)
    iCh = StringGetChar(s,i);

  return(StringSubstr(s,0,i+2));
}//sTrimRightZeros()
Reason: