Round Numbers – Wildcard Character

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4877 quote
    minmax
    Participant
    Average

    Firstly, thanks for creating the ProRealCode website, it’s going to be a great resource.

    I’d like to make strategies aware of key levels where the market will have support/resistance

    For example…

    If price (OHLC) is within X points of XX,000/XX,050 etc.. then don’t trade/set stop to minimum level etc..

    Is there anyway to use wildcard characters in PRT?

    Regards

    Steve

    #4908 quote
    Jerry
    Participant
    New

    Minmax, why would you need a wildcard, could you please elaborate on your example?

    .

    #4909 quote
    minmax
    Participant
    Average

    Hi Jerry, It’s a support and resistance level, any strategy needs to take it into account, having a wildcard character would save me adding every number ending in 000 or 050 from 0 to 20,000 into my support and resistance indicator

    For example..

    if price(ohlc) is within 10 pips of 17,000 or 18,000 or 19,000, or 20,000 or 21,000 etc… (and every number in between) then set stop loss 10

    Would become: if price(ohlc) is within 10 pips of a number ending XX,000 or XX,100, XX,050 then set stop loss to 10

    I was thinking there must be a mathematical formula to achieve the same thing, any ideas?

    Regards

    Steve

    #95397 quote
    theoldhopbarn
    Participant
    New

    Hi MinMax,

    Use the MOD function.

    eg.

    if CLOSE MOD 50 = 0 then
    //CLOSE IS DIVISIBLE BY 50
    insert your code here
    else
    //CLOSE NOT DIVISIBLE BY 50
    insert your code here
    endif

     

    Explanation: The MOD function returns the remainder from a division. So if you want to check to see if the CLOSE ends with 00 or 50, it will return 0 when the division is carried out.

    CLOSE = 1234,  1234 MOD 50 = 34

    CLOSE = 1250,  1250 MOD 50 = 0

    CLOSE = 1300,  1300 MOD 50 = 0

    minmax and Nicolas thanked this post
    #95405 quote
    Vonasi
    Moderator
    Master

    theoldhopbarn – welcome to the forums and thank you for providing minmax with a solution. He is very patient as he has waited 33 months for it!

    Could you please use the ‘Insert PRT Code’ button when putting code in your future post as it makes it so much easier for others to read. I have tidied up your post for you. 🙂

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

Round Numbers – Wildcard Character


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
minmax @minmax Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by Vonasi
6 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/05/2016
Status: Active
Attachments: No files
Logo Logo
Loading...