How to Turn a Negative ratio into a Positive

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #54087 quote
    GLENGOLOLOGLENGOLOLO
    Participant
    Junior

     

    Fractions have a top number, which is called the numerator, and a bottom number, which is known as the denominator. This combination of numbers represents how a part relates to a whole. If you have a negative number or variable in the denominator of a fraction, the fraction is not in simplest form, according to traditional mathematics. To state the fraction properly, you must take measures to convert the negative value in the denominator to a positive one.

    example if the code return negative ratio how do turn it into a positive
    a=open
    b=close
    Distance = (a-b)
    
    RETURN Distance
    

     

     

    #54088 quote
    GLENGOLOLOGLENGOLOLO
    Participant
    Junior
    1
    <strong><em>example if the code return negative ratio how do turn it into a positive</em></strong>

     is a mistake

    real question  “example if the code return negative ratio how do turn it into a positive”

    #54093 quote
    NobodyNobody
    Participant
    Veteran
    a=open
    b=close
    c  = (ab)
     
    Distance = c * -1
     
     
    RETURN Distance
    GLENGOLOLO thanked this post
    #54098 quote
    NobodyNobody
    Participant
    Veteran

    Or im guesssing this might work if you do get either a positive or negative C outcome  . 

    IF (C < 0) THEN
                     Distance = C * -1
               ELSE
                     Distance = C 
               ENDIF
    NEXT
    
    RETURN Distance
    
            
            
        
    #54101 quote
    GLENGOLOLOGLENGOLOLO
    Participant
    Junior

    First code worked very well, second one i guess i will be using it in near future.

    Thank you for your assistance 

    #54118 quote
    AutoStrategistAutoStrategist
    Participant
    Veteran
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

How to Turn a Negative ratio into a Positive


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
GLENGOLOLO @glengololo Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by AutoStrategistAutoStrategist
8 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/27/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...