Minimum distance from Support or resistance

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #197890 quote
    Stocks008
    Participant
    Average

    Good day,

    I am trying to code an indicator that will take support and resistance into account. I am struggling with the minimum distance from support or resistance part. Let’s say the support or resistance will be given by the 30 SMA and 100 SMA. The indicator should only draw instruction if the support or resistance ( 30 and 100 averages) is further away than 10 points from the current candle’s open price. Is there a way to do this and always get a positive value in points?

    I hope I made enough sense in my question.

    Thank you,

    Kind Regards

    #197892 quote
    robertogozzi
    Moderator
    Master

    There you go:

    ONCE Distance = 10 * PipSize
    MySupport     = average[30,0](close)
    MyResistance  = average[100,0](close)
    Signal        = 0
    IF open >= (MySupport + Distance) THEN
       Signal = -1
    ELSIF open <= (MyResistance - Distance) THEN
       Signal = 1
    ENDIF
    RETURN Signal AS "Signal"
    Stocks008 thanked this post
    #197899 quote
    Stocks008
    Participant
    Average

    Thank you very much, I appreciate your help. 🙂

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

Minimum distance from Support or resistance


ProBuilder support

New Reply
Author
author-avatar
Stocks008 @jd008 Participant
Summary

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

Topic Details
Forum: ProBuilder support
Language: English
Started: 07/25/2022
Status: Active
Attachments: No files
Logo Logo
Loading...