New trading instructions: better management of your orders!
Forums › ProRealTime English forum › ProOrder support › New trading instructions: better management of your orders!
- This topic has 7 replies, 3 voices, and was last updated 2 years ago by Nicolas.
-
-
03/17/2022 at 4:14 PM #190105
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!
Total of 17 users thanked author for this post. Here are last 10 listed.
03/17/2022 at 4:14 PM #190108ShortTriggered[N] / LongTriggered[N] examples:
Orders count, limit orders to X for today:
1234567891011121314151617once MaxOrders = 5//reset orders countif intradaybarindex=0 thenorderscount=0endif//check if an order has opened in the current barif longtriggered thenorderscount=orderscount + 1endifif not longonmarket and orderscount<MaxOrders thenbuy 1 contract at high stopset target pprofit 20set stop ploss 10endif1 user thanked author for this post.
05/10/2022 at 9:47 AM #192982All 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.
05/10/2022 at 9:55 AM #192984Set 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:
12345inprofit = lowest[10](low)>tradepriceif inprofit and longonmarket thenset stop breakevenendif05/10/2022 at 9:57 AM #192986Set Stop Price example:
Stoploss at 5-bars lowest low at order launch:
1234if buycondition and not longonmarket thenbuy 1 contract at marketset stop price lowest[5](low)endif05/11/2022 at 7:18 AM #193026Trailing stop profit example made with Set Stop Price:
https://www.prorealcode.com/topic/trailing-profit-target/#post-192622
1 user thanked author for this post.
05/11/2022 at 7:53 AM #19303105/11/2022 at 8:04 AM #193032No, 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.
1 user thanked author for this post.
- 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)
-
AuthorPosts
Find exclusive trading pro-tools on