4 lines of code - 1 calculation not working...

1
These lines calls on Mathabs("score") depending on whether "positive" score (totalAPLUS) or "negative" score (totalMINUS) is higher.
Does anyone see anything obviously wrong?

Code: Select all

Bimap(StringConcatenate(TradePair[i],"scor1"), CORNER_RIGHT_UPPER, (adW-204), (adH- 0)+((i+0)*42), 83, 39, colourFon, ModColor(colourFon), totalAPLUS>MathAbs(totalMINUS)?clrLime:255, false,
ALIGN_CENTER, " ", 24, "Harabara", totalAPLUS>MathAbs(totalMINUS) ?  DoubleToStr(totalAPLUS/(MathAbs(totalMINUS)!=0?MathAbs(totalMINUS):1),1) /* +" : 1 " */
:  DoubleToStr(MathAbs(totalMINUS)/(totalAPLUS!=0?totalAPLUS:1),1) /* +" : 1" */, "RATIO"); 
It is working perfectly EXCEPT when it is calling on totalAPLUS/totalMINUS and totalAPlus is effectively 100% and totalMINUS is 0%. So, it seems like when totalAPlus is "high" and totalMinus is "0", or "lowest possible", it is calling the wrong calculation.

These are the code lines that are problematic:

Code: Select all

totalAPLUS>MathAbs(totalMINUS)?clrLime:255, false,
         ALIGN_CENTER, " ", 24, "Harabara", totalAPLUS>MathAbs(totalMINUS) ?  DoubleToStr(totalAPLUS/(MathAbs(totalMINUS)!=0?MathAbs(totalMINUS):1),1) /* +" : 1 " */
                                                                       :  DoubleToStr(MathAbs(totalMINUS)/(totalAPLUS!=0?totalAPLUS:1),1)
 
I am struggling to work out the logic from the code to correct it.

Does ? substitute as "if" and ":" is then?


Who is online

Users browsing this forum: No registered users and 16 guests