MA stop loss

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #120288 quote
    JackDJackD
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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
    VonasiVonasi
    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
    JackDJackD
    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.
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

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 JackDJackD
6 years, 7 months ago.

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