stop loss linked to a moving average

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #140796 quote
    George65George65
    Participant
    Senior

    Hi,

     

    Can someone help me please how I can give a stop loss order with the SMA?

    I’ve tried it two different ways, none of them are executed.

    1. IF not longonmarket and c1 and c2 and c3 and c9 THEN
      BUY 1 CONTRACT AT MARKET
      set stop loss Average[20](close)
    2. IF not longonmarket and c1 and c2 and c3 and c9 THEN
      BUY 1 CONTRACT AT MARKET
      sell at Average[20](close) stop

    thanks

    George

    #140803 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    The correct form is:

    1. stop loss abs(close – Average[20](close))      because SET STOP LOSS requires a difference in price, not a price
    2. correct, provided the current price (CLOSE) il higher than Average[20]
    #140808 quote
    George65George65
    Participant
    Senior

    Thanks Roberto for your support!

    Though you write version 2 is correct, it is not executed.

    I’ll try version 1

    Thanks again!

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

stop loss linked to a moving average


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
George65 @george65 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by George65George65
6 years, 2 months ago.

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