Supertrend Movement Coding Question

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #209698 quote
    Mishap
    Participant
    Junior

    Hi Guys,

    Im not sure how to explain this one but I am hoping to create some code for my strategy that takes into account certain movement of the supertrend to act as a buy or sell signal.  I am hoping to get the signal when the supertrend “bounces” after a quick move down or up. I am looking for the signal as per the attached image (buy shown). it also needs to have crossed below price as in the image. Does anyone have any idea on how to create an input that creates a signal for this? any help is appreciated.

    If more information is needed hit me up below, I will post code when I get back to my PC but for now I am out at the moment sorry. (the issue has been bugging me all day 🤔)

    #209706 quote
    Nicolas
    Keymaster
    Master

    This movement is when the Supertrend is turning red to green or green to red, when a candle crosses under or crosses over.

    Think of the Supertrend as a channel, a line is visible and in color and the other one (at the opposite side) is invisible until the price cross it and become visible and the previous one invisible. That’s why you see the a line that join the opposite sides when the price crossing occur.

    This is the code to detect the Supertrend color change:

    st=supertrend[3,10]
    
    signal = 0
    if close crosses over st then 
     signal = 1
    elsif close crosses under st then 
     signal = -1
    endif 
    
    return signal
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Supertrend Movement Coding Question


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Mishap @mishap Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
2 years, 12 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/15/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...