MA stop loss

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #120288 quote
    JackD
    Participant
    Junior

    Hi,

    I have been looking but I can find a trailing stop loss that follows a chosen moving average. Is there such a thing?

    thanks in advance

     

    Jack

    #120300 quote
    robertogozzi
    Moderator
    Master

    I don’t know, but this is an example to exit a LONG trade based on a MA:

    IF LongOnMarket THEN
       SELL AT average[20](close) STOP
    ENDIF

    If you are LONG you can assume your price is ABOVE that average, so when it’s touched on a retracement or inversion, your trade will be exited.

    #120324 quote
    Vonasi
    Moderator
    Master

    Roberto – your code needs to also have the sell stop order at the time of entry otherwise the order has to wait one candle before it is placed and your stop loss is not in place for one whole candle.

    if (your conditions) then 
    buy 1 contract at market
    SELL AT average[20](close) STOP
    endif
    
    IF LongOnMarket THEN
       SELL AT average[20](close) STOP
    ENDIF
    robertogozzi thanked this post
    #120430 quote
    JackD
    Participant
    Junior

    Thank you so much! Both of you, I really appreciate it.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

MA stop loss


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
JackD @jackd Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by JackD
6 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/24/2020
Status: Active
Attachments: No files
Logo Logo
Loading...