How to keep a constant value for a SL calculated at TRADEINEX?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #167825 quote
    KhaledKhaled
    Participant
    Veteran

    Hi everyone,

    I’d like to keep my SL constant equal to (for Long)

    SL=TRADEPRICE-Low[1]

    The problem in writing TRADEPRICE-Low[1] is that Low[1] keeps changing at each bar.

    Once executing a trade, how can I keep this value constant until exiting the trade?

    Thanks

    #167826 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    First set SL to ZERO when Not OnMarket, then use your expression only when SL=0. So it will not change next bar:

    If Not OnMarket then
      SL = 0
    Endif
     .
     .
     If OnMarket and SL = 0 then
       SL=TRADEPRICE-Low[1]
    Endif
    Khaled and Midlanddave 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

How to keep a constant value for a SL calculated at TRADEINEX?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Khaled @khaled Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/22/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...