Tradeprice and Limits

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #26204 quote
    pips_103
    Participant
    Average

    Hi Guys, Hoping you can help…….

    My question is in 2 parts:

    1: I enter a buy position, and i can tell what the entry is by Tradeprice(1)
    Then a few bars later I enter a 2nd (cumulate) buy position.
    Question: Is the 1st position still Tradeprice(1) and the 2nd position Tradeprice(2)? (or visa versa)?

    2: I enter a buy position, with Take Profit (Limit) at 20 pips
    Then a few bars later buy another (cumulative) position. (My 2nd added position also then automatically has a Take Profit of 20 pips).
    I now have 2 positions both with a Take profit of 20 pips
    Question: How do i now alter only the 1st position to take profit at a different level (ie change the limit to say 50 only on the 1st position)?

    Any help is appreciated.

    #26234 quote
    Derek
    Participant
    Veteran

    Hello pips_103,

    1. The very last position opened is tradeprice(0). So the order is in reverse from when the trades were executed.
    2. Maybe this thread will help: https://www.prorealcode.com/topic/stop-loss-profit-target-do-they-affect-all-positions/

    Concerning 2) does this help?

    pips_103 thanked this post
    #26263 quote
    pips_103
    Participant
    Average

    Thanks Derek, appreciated

    #26332 quote
    Derek
    Participant
    Veteran

    Hello Pips,

    just got into this topic myself and found this in the proorder manual:

    Multiple stop and target levels

    Only one “Set Stop” and one “Set Target” command can be active at a time under normal circumstances. If there are successive “Set Stop” or “Set Target” commands in a code, the last command replaces the previous command.

    Example:

    SET STOP %LOSS 10 // Set a stop loss of 10%
    
    SET TARGET PROFIT 50 // Set a profit target of 50 units
    
    SET TARGET %PROFIT 5 // Removes the previous target of 50 units and replaces it with a profit target of 5%
    
    SET STOP %TRAILING 2 // Removes the previous 10% stop loss and replaces it with a trailing stop of 2%

     

    So, I guess the answer is “no”, unfortunately.

    #26333 quote
    pips_103
    Participant
    Average

    ah yes, your right, Thanks Derek 🙂

    #94374 quote
    deletedaccount06012021
    Participant
    New

    The very last position opened is tradeprice(0). So the order is in reverse from when the trades were executed.

    Follow up on this — on a candle there could be an “buy long” order that happens as well as “trailing stop loss” order triggered exiting a previous position (or perhaps the one you just entered if it’s a long candle).

    Question — in your code how do you know/determine which came first on that candle and what the value of each order was?

    THank you

    #94380 quote
    Nicolas
    Keymaster
    Master

    If you want to know if the last tradeprice is the trailing stop activated, check if the order is in profit or not.

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

Tradeprice and Limits


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
pips_103 @pips_103 Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/23/2017
Status: Active
Attachments: No files
Logo Logo
Loading...