pTRAILING STOP LOSS in MTF

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #140924 quote
    PhilA
    Participant
    New

    Good morning, sorry to bother everyone again with my silly questions.

    I am trying to set a trailing stop loss at a recent low of the x day close.

    Using multi time frame I have set the variable like this:

    Timeframe(daily,updateonclose)
    LongExit = lowest[200](close)
    Timeframe(default,updateonclose)

    I have used GRAPH to check what LongExit returns and it works correctly, it gives me the lowest close of the last 200 days and it updates at the close of the daily bar.

    The default timeframe is HOURLY.

    I want to use ‘LongExit’ as a trailing stop loss. I have this:

    IF longentryconditions THEN
    BUY PositionSize PERPOINT AT MARKET
    SET STOP pTRAILING (Close - LongExit)
    ENDIF

    I want it to ONLY MOVE THE STOP at the close of the day, when LongExit changes?

    At the moment it is moving the stop continually in steps of 1, every time the live price moves upwards by 1 point.

    Thanks.

    #140930 quote
    PhilA
    Participant
    New

    What if I did it this way instead, would this move the pending stop order each day as the value of the variable LongExit is updated at the daily close?

    // Conditions to enter long positions
    IF LongEntryConditions THEN
    BUY PositionSize PERPOINT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    IF LONGONMARKET THEN
    SELL AT LongExit STOP
    ENDIF
    #140962 quote
    Nicolas
    Keymaster
    Master

    The SET TRAILING instruction attach a trailing stop to the order that is then handle by the broker, so calling this instruction again will have no effect on when the stoploss will be moved.

    Your second example is the good one. Since the “LongExit” variable will be updated once every day, therefore the pending order level will change only once too.

    PhilA thanked this post
    #140980 quote
    PhilA
    Participant
    New

    Ok that’s what I was hoping, merci.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

pTRAILING STOP LOSS in MTF


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
PhilA @phila Participant
Summary

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

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