How can i modify trailing stop ATR based when i will be in profit

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

    Hello to all,
    I have a trailing stop ATR based and would like to modify it
    (Lowering the ATR) multiplier to get out earlier if you turn when i’m in profit
    to avoid going in loss.

    Could you tell me how to do it, please, to find out if I’m in profit and how much euro?
    This is the trailing stop code:

    //default parameter values:
    //ATRmoltiplicatore=1.9
    //ATRperiodo=5
    
    myhigh = highest[3](high) - ATRmoltiplicatore*(AverageTrueRange[ATRperiodo](close))
    IF (mytot > low) THEN
    myx = 0
    ELSE
    myx = myx + 0.03
    ENDIF
    myextra = (myx[1])*(AverageTrueRange[ATRperiodo](close))
    mytot = myhigh + myextra
    RETURN mytot

     

    thanks

    #6127 quote
    Nicolas
    Keymaster
    Master

    You can calculate the actual position profit by making the difference between the open price of a position with TRADEPRICE and the actual close.

    Then, multiply this difference with the point value of the instrument : POINTVALUE

    And you’ll get the profit of the current position, but without fees of course

    #6363 quote
    lenny66
    Participant
    New

    Hi Nicolas,

    thank you very much.

    best regards,

    Aldo

    #13823 quote
    andrea1981
    Participant
    New

    Do you have an example? because I create a code that is the same….but it doesn’t work….

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

How can i modify trailing stop ATR based when i will be in profit


Platform Support: Charts, Data & Broker Setup

New Reply
Author
author-avatar
lenny66 @lenny66 Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by andrea1981
9 years, 4 months ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 04/27/2016
Status: Active
Attachments: No files
Logo Logo
Loading...