Possible to attach a stop loss to a moving average ?

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

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

    #250348 quote
    GraHal
    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
    Nicolas
    Keymaster
    Master

    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.

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 Nicolas
5 months, 2 weeks ago.

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