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
    Khaled
    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
    robertogozzi
    Moderator
    Master

    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.

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 robertogozzi
4 years, 10 months ago.

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