visualiser que 2 décimales

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #97899 quote
    swapping
    Participant
    Master
    // Code to view result with two decimal only
    
    DefParam DrawOnLastBarOnly = true
    Period  = (20)
    ATR     = (AverageTrueRange[Period])
    DrawText("ATR(#period#) → #atr#",barindex-20,0.0,SansSerif,Standard,15)
    
    return

    Bonjour, comment modifier le code pour ne visualiser que 2 décimales avec cet exemple très simple ?

    merci bien

    #97902 quote
    robertogozzi
    Moderator
    Master

    Le langage PRT ne prend pas en charge la troncature, vous pouvez seulement arrondir un nombre à deux décimales (multipliez-le par 100, puis arrondissez-le, puis divisez-le par 100), mais vous verrez toujours les 0.

    swapping thanked this post
    #98108 quote
    swapping
    Participant
    Master
    // Code to view result with two decimal only
    
    DefParam DrawOnLastBarOnly = true
    Period  = (20)
    ATR     = (AverageTrueRange[Period])
    ATRnd   = round(atr*100)/100         // rounded because no troncation
    DrawText("ATR(#period#) → #ATRnd#",barindex-20,0.0,SansSerif,Standard,15)
    
    return

    merci bien roberto

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

visualiser que 2 décimales


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
swapping @swapping Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by swapping
6 years, 10 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 05/08/2019
Status: Active
Attachments: No files
Logo Logo
Loading...