New trading instructions: better management of your orders!

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #190105 quote
    Nicolas
    Keymaster
    Master

    Here is a new list of instructions specific to order management in automatic trading, which should greatly improve your programming.
    Largely inspired by the many support requests and remarks gleaned over the years on the forum, I’m sure you’ll appreciate these, so much they will simplify the setting of breakeven or the placement of stops for example.

    I’ve been testing them for a few weeks in beta and it works very well 🙂

    Here is the list:

    • ShortTriggered[N] / LongTriggered[N] : Allows to know if a Short / Long position has been opened on the candlestick N (optional N by default at 0)
      Useful to know when an order has been opened and its stop / profit has been triggered on the same candlestick, especially in the case of a WO position opening.
    • Set Stop Breakeven : Allows you to set a protective stop at the entry price of the current position, avoids the use of a closing WO.
    • Set Stop Price X : Allows to set a stop at a price X defined directly by the user and not in relation to the entry price of the position.
    • Set Stop pProfit/%Profit/$Profit/Profit X : Allows to set a stop at X points / % / € / unit above the entry price of the position.
    • Set target Breakeven : Allows to set a profit limit at the entry price of the current position, avoids the use of closing WO.
    • Set target Price X : Allows to set a profit limit at a price X defined directly by the user and not in relation to the entry price of the position.
    • Set target ploss/%loss/$loss/loss X : Allows to set a limit at X points / % / € / unit below the entry price of the position.

    (WO states for Working Orders, also known as “pending orders”)

    All these instructions are now available for any version of the platform, enjoy!

    JC_Bywan, nonetheless, JS and 14 others thanked this post
    #190108 quote
    Nicolas
    Keymaster
    Master

    ShortTriggered[N] / LongTriggered[N] examples: 

    Orders count, limit orders to X for today:

    once MaxOrders = 5
    
    //reset orders count 
    if intradaybarindex=0 then 
     orderscount=0
    endif 
    
    //check if an order has opened in the current bar 
    if longtriggered then 
     orderscount=orderscount + 1
    endif
    
    if not longonmarket and orderscount<MaxOrders then 
     buy 1 contract at high stop 
     set target pprofit 20
     set stop ploss 10
    endif
    PastaPesto thanked this post
    #192982 quote
    Nicolas
    Keymaster
    Master

    All these new instructions have now been added in our online documentation for ProOrder/ProBacktest. Direct links for each of them are available in the above post.

    #192984 quote
    Nicolas
    Keymaster
    Master

    Set Stop Breakeven example:

    Put my long order at breakeven (stoploss at entry price) if price is above the entry price (in profit) since 10 bars:

    inprofit = lowest[10](low)>tradeprice
    
    if inprofit and longonmarket then 
     set stop breakeven
    endif
    #192986 quote
    Nicolas
    Keymaster
    Master

    Set Stop Price example: 

    Stoploss at 5-bars lowest low at order launch:

    if buycondition and not longonmarket then 
     buy 1 contract at market 
     set stop price lowest[5](low)
    endif
    #193026 quote
    JC_Bywan
    Moderator
    Master

    Trailing stop profit example made with Set Stop Price:

    Trailing Profit Target

    Nicolas thanked this post
    #193031 quote
    phoentzs
    Participant
    Master

    I have a question about that. Would this feature replace all the trailing stopcodes that exist?

    #193032 quote
    Nicolas
    Keymaster
    Master

    No, they do not replace them, these new instructions make things easier!

    For instance, no need to take care of continuously put a pending stop order at breakeven with a soft code version (countless codes about that in the forums!), just use the new SET STOP BREAKEVEN, and the server will take care of the rest when dealing with the broker.

    Same goes with SET TARGET or SET STOP at PRICE.

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

New trading instructions: better management of your orders!


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Nicolas @nicolas Keymaster
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/17/2022
Status: Active
Attachments: No files
Logo Logo
Loading...