Possible to attach a stop loss to a moving average ?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #250339 quote
    casamaniacasamania
    Participant
    Average

    Is it possible to attach a stop loss to a moving average ?

    #250348 quote
    GraHalGraHal
    Participant
    Master

    Mmmm maybe you need to define more what is in your mind?

    A Stop Loss is attached an Open Trade and therefore attached to Price of that Open Trade, which – by chance – could be the same as the value of a Moving Average … if your entry was, for example …

    If Close = Average[20](Close) Then
    Buy at Market
    Endif

    But to achieve an entry exact same as the value of MA[20]  would be unusual / luck. Chances would be best if running on a 1 second (or less) Chart Timeframe.

    #250386 quote
    NicolasNicolas
    Keymaster
    Legend

    You can use the SET STOP PRICE instruction which put the stoploss order on a price value.

    At order ignition:

    MA = average[20]
    if buyCondition then 
     buy at market 
     set stop price MA
    endif 

    during the lifetime of the order: (stoploss will follow strictly the MA value)

    if longonmarket then 
     set stop price MA
    endif 
    GraHal, robertogozzi and Iván González thanked this post
Viewing 3 posts - 1 through 3 (of 3 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

Possible to attach a stop loss to a moving average ?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
casamania @casamania Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by NicolasNicolas
1 year ago.

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