Stop Loss at last swing low

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #121803 quote
    George SummersGeorge Summers
    Participant
    New

    Hi All,

    I’m new to automated trading so your kind help would be much appreciated.

    I want to provide a stop loss at the last swing low, for example just below the low (e.g. 2 points) of the last 3 bars, however, I want the stop to be fixed at that price and not trail (not last 3 bars from current bar as time passes).

    Thanks very much šŸ™‚

    Kindest Regards,

    George

    #121807 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    You have to set your Stop Loss when you place an order, so it will not move (LONG example):

    IF MyLongConditions AND Not OnMarket THEN
       BUY 1 CONTRACT AT MARKET
       SET STOP LOSS abs(close - (lowest[3](low) - 3 * pipsize))
    ENDIF
    George Summers thanked this post
    #121808 quote
    George SummersGeorge Summers
    Participant
    New

    Hi Roberto,

    Thank you very much, I will give it a shot.

    George

    #121809 quote
    George SummersGeorge Summers
    Participant
    New

    Hi Roberto,

    Yep, that works.

    And if I wanted to set my profit say 2 times my risk?

    Thanks again.

    George

    #121820 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Then you have to save your stop loss in a variable, then use it with a multiplier:
    [scode]
    IF MyLongConditions AND Not OnMarket THEN
    BUY 1 CONTRACT AT MARKET
    SL = abs(close – (lowest[3](low) – 3 * pipsize))
    SET STOP LOSS SL
    SET TARGET PROFIT SL * 2
    ENDIF
    [/scode]

    George Summers thanked this post
    #122103 quote
    George SummersGeorge Summers
    Participant
    New

    Thanks again Roberto.

Viewing 6 posts - 1 through 6 (of 6 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 at last swing low


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by George SummersGeorge Summers
6 years, 6 months ago.

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