|
Attention! Read the forum rules carefully before posting a topic.
Try to find an answer in Wiki before asking a question. Submit programming questions in this forum only. Off topics are strictly forbidden.
Any topics which do not satisfy these rules will be deleted.
2 trade in same pair, one swing and other scalping |
jaime_1008
|
Post subject: 2 trade in same pair, one swing and other scalping |
Post rating: 0
|
Posted: Wed 30 May, 2012, 14:24
|
|
User rating: 1
Joined: Sun 18 Dec, 2011, 04:05 Posts: 36 Location: Spain, Madrid
|
Hi,
I having the following problem. i have running two strategies at the same time, one make swing trades and the other scalp trades, on scalp strategy i have a breakeven activated and affect also on swing trades (or any open position on this pair). How can i make breakeven ONLY for scalp open positions?. I think by labels but i have tried without results.
Best regards Thanks
|
|
|
|
 |
API Support
|
Post subject: Re: 2 trade in same pair, one swing and other scalping |
Post rating: 0
|
Posted: Wed 30 May, 2012, 14:32
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
There are a couple of things that you can do: - String operations should work. For instance if your strategy orders have a particular prefix, then select the orders by a condition like
order.getLabel().startsWith("MyPrefix") - On order submission you can add a comment to it and afterwards check orders by their comment, i.e., IOrder.getComment().
- If the strategy works only with its own orders (i.e., only the orders that it has created itself), then you can keep your orders in a list, e.g., on every order submit add it to the list:
List<IOrder> myOrders = new ArrayList<IOrder>(); //... IOrder order = engine.submitOrder("order1", Instrument.EURUSD, OrderCommand.BUY, 0.01); myOrders.add(order);
|
|
|
|
 |
jaime_1008
|
Post subject: Re: 2 trade in same pair, one swing and other scalping |
Post rating: 0
|
Posted: Thu 31 May, 2012, 03:45
|
|
User rating: 1
Joined: Sun 18 Dec, 2011, 04:05 Posts: 36 Location: Spain, Madrid
|
Ok.
I`ll do it first with prefix, in my case create labels with prefix "scalpXX" and another "swingXX". X are numers.
The 3 choise looks good also, but i think little more dificult for programming.
thank you. Best regards
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|