Stop Loss and Target Profit based on Position Size

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #140632 quote
    FrancescoFrancesco
    Participant
    Veteran

    Hi guys, I would like to know If and how it’s possible to set a target profit or a stop loss based on a certain percentage of the position size.

    For example, on a system that has 100 euros positions, I would like a 20% target profit and a 10% stop loss based on those position sizes.

    Thanks.

    #140636 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Using the symbol % with PROFIT and LOSS ensures your profit or loss is a percentage of the price, no matter whether you traded 1, 2 or 100 lots.

    If you are trading something having a value of € X you first have to compute the value of your positions with:

    TradedValue = pointvalue * abs(countofposition)

    TradedValue is the value for each pip/point.

    If that value is, say, € 1, you need to set a stop loss of 10 pips to risk € 10 and twice that as your target.

    #140649 quote
    FrancescoFrancesco
    Participant
    Veteran

    The fact is that i would like to have a method in order to standardize sl and tp for every assett on which i use an unique strategy.
    The tradedvalue it would be different between two different assets (as well as sl% and tp%), and so i have to optimize values in order to achieve the same result (i.e. 20%)

    For that i thought to a margin based solution (of course using the same margin amount for every assett)

    Is there a solid way to standardize it?

    #140660 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Searching for MONEY you can find many code snippets, strategies and examples worth while reading.

    You can start from this one https://www.prorealcode.com/blog/learning/money-management-prorealtime-code/.

    Francesco thanked this post
    #140665 quote
    FrancescoFrancesco
    Participant
    Veteran

    At the end i decided to manually find a solution, supposing that i run a system on two different assets, i put at first the same position size:

    Assett 1: 1.5 contracts= 1100$

    Assett 2: 3.5 contracts= 1100$

    Then simply

    set target $profit 220
    set stop $loss 110

    Which is 20% and 10% of the margin.

    Then i just have to manage the number of contracts in order to have it fixed around 1100€ considering price changes of the assetts through weeks and market movings.

Viewing 5 posts - 1 through 5 (of 5 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 and Target Profit based on Position Size


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

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

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