SL on last candle

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #150463 quote
    umebonumebon
    Participant
    Average

    Hi

    I have read and tried too figure this out but I can’t get it too work. I would like too have a SL that moves with previous candle. If price moves up i want SL too move to be set too last candles low. I’m working long only..

    #150465 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go:

    IF Not OnMarket THEN
       NewSL = 0                     //clear NewSL when not OnMarket
    ELSE
       IF close > close[1] THEN      //update stop loss when price is rising
          NewSL = max(NewSL,low[1])  //to previous candle's low, if higher than before
       ENDIF
       IF NewSL > 0 THEN
          SELL AT NewSL STOP         //exit at calculated stop, if any
       ENDIF
    ENDIF
    umebon thanked this post
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

SL on last candle


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
umebon @umebon Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
5 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/14/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...