set take profit as risk to reward from stop

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #174073 quote
    MishapMishap
    Participant
    Junior

    Hi Guys,

    Sorry if this has been covered, i have been trawling the forums for a bit now & cannot find the answer. i want to run a risk reward of 1:3 but am unsure how to get correct percentage from the stop.

    essentially i ant to buy at market set stop at high or low of last [n] bars then make take profit 3 x the distance from market order to stop loss. can anyone help?

    snippet below

    h1 = high[20]
    l1 = low[20]
    
    if longonmarket then
    set target profit ??
    set stop loss l1
    endif
    
    if shortonmarket then
    set target profit ??
    set stop loss h1
    endif
    #174080 quote
    nonethelessnonetheless
    Participant
    Master

    Something like this?

    tp = (positionprice - L1)*3 + positionprice
    
    
    
    Mishap thanked this post
    #174081 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    LOSS requires a difference expressed in price, not a price, thus it should be:

    tp = (positionprice - L1)*3   //Long
    tp = (H1 - positionprice)*3   //Short
    nonetheless, Midlanddave and Mishap thanked this post
    #174102 quote
    MishapMishap
    Participant
    Junior

    Thanks guys this is a massive help. sorry if this seems elementary stuff im still trying to get my head around things. its hard to teach an old dog new tricks šŸ™‚

    so to confirm my SL is also wrong & using LOSS it should be:

    	
    SL = (positionprice - L1)  //Long
    SL = (H1 - positionprice)   //Short
    #174103 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Yes, that’s correct.

    You can first calculate SL, then TP as a multiple of SL:

    SL = (positionprice - L1)  //Long
    SL = (H1 - positionprice)  //Short
    TP = SL * 3                //Long & Short
    Mishap thanked this post
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

set take profit as risk to reward from stop


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Mishap @mishap Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/24/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...