Announcement

Collapse
No announcement yet.

Restricting decimal places

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Restricting decimal places

    I have an alert that produces an average of volume - How do I restrict it to just whole nos?
    Also is it possible to change the colours of individual items in the alert list?

  • #2
    Russell
    I think the following should give you a whole number
    Alert.addToList(getSymbol(), yourvalue.toFixed(0), Color.RGB(0,0,0), Color.RGB(0,0,255))
    Alex

    Comment


    • #3
      Sorry to be dim but yourvalue I assume means my variable that has the average in it so

      vSMA5_of_Volume.getValue(MAStudy.MA)to fixed(0) ??
      Attached Files

      Comment


      • #4
        Russell
        Yes that is what I meant.
        However it does not seem to work in this context. There is another solution (I have made sure this one works)

        Alert.addToList(getSymbol(), "Price "+close()+" "+"Av "+Math.round(vSMA5_of_Volume.getValue(MAStudy.MA)) +" "+"Vol "+volume(), Color.RGB(0,0,0), Color.RGB(0,0,255));

        As an aside you can use also Math.round(vSMA5_of_Volume.getValue(MAStudy.MA)) in the return new Array so that you limit the display on the chart to integer only
        Alex

        Comment


        • #5
          Thats great - and can you alter colours for different texts eg one colour for volume and another colour for the average?

          Comment


          • #6
            Russell
            I am not sure but I do not believe that is possible.
            Seems to me there is only one setting for text (ie foreground) color.
            Alex
            Last edited by ACM; 05-15-2003, 08:03 AM.

            Comment

            Working...
            X