Dukascopy
 
 
Wiki JStore Search Login

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
 Post subject: 2 trade in same pair, one swing and other scalping Post rating: 0   Post Posted: Wed 30 May, 2012, 14:24 
User avatar

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


 
 Post subject: Re: 2 trade in same pair, one swing and other scalping Post rating: 0   Post Posted: Wed 30 May, 2012, 14:32 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
There are a couple of things that you can do:
  1. 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")
  2. On order submission you can add a comment to it and afterwards check orders by their comment, i.e., IOrder.getComment().
  3. 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);


 
 Post subject: Re: 2 trade in same pair, one swing and other scalping Post rating: 0   Post Posted: Thu 31 May, 2012, 03:45 
User avatar

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


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com