Check for odd numbers

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #157145 quote
    GrantxGrantx
    Participant
    Average

    How do I skip odd numbers (or evens) in the following code:

    //04.01.2021
    //Grantx
    
    //vertical offset to draw text correctly over horizontal lines
    Voffset = 1.2*pipsize
    
    DRAWTEXT(IntradayBarIndex, barindex, high+Voffset, Dialog,Standard, 20) COLOURED(255,255,255)
    
    
    RETURN
    
    #157146 quote
    VonasiVonasi
    Moderator
    Master

    Use MOD.

    MOD

    Grantx thanked this post
    #157156 quote
    GrantxGrantx
    Participant
    Average

    Thanks for your reply. How though? How do I filter odds using MOD? documentation doesnt say much..

    #157159 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    EvenNumber = ((Number MOD 2) =0)
    OddNumber  = ((Number MOD 2) =1)

    only one of the two variables can be true each time.

    Grantx thanked this post
    #157199 quote
    GrantxGrantx
    Participant
    Average

    Thanks that works.

    Is there a way to be able to change the colour and size of those numbers by using the indicator settings panel? ie not having to change the code.

    #157201 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    No, there’s no way. You can’t use variables so you’ll have to change the code.

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

Check for odd numbers


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Grantx @grantx Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/09/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...