Using Supertrend as stop loss

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #105763 quote
    AlgoAlexAlgoAlex
    Participant
    Master

    Guys, how should I use a value in supertrend as initial stop loss?

    I don’t wanna close the order when close crosses over/under it, what I want is to use the value of Supertrend (or a moving average) at the bar of opening order as a level for stop loss.

    #105764 quote
    NicolasNicolas
    Keymaster
    Legend

    A the time you open an order, calculate the stoploss size by substracting the supertrend to the current Close:

    if condition then 
     buy at market 
     stoploss = close-supertrend[3,10]
     set stop loss stoploss
    endif

    (for a buy order, considering the Supertrend is below the price).

Viewing 2 posts - 1 through 2 (of 2 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

Using Supertrend as stop loss


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
AlgoAlex @alexf Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by NicolasNicolas
7 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/28/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...