Different Instances with Label

Created at 11 Oct 2013, 12:29
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
RK

rkokerti

Joined 28.06.2012

Different Instances with Label
11 Oct 2013, 12:29


Hello!

1. If I would like to open positions in different currency pairs with a specific robot, then I can do it so:

    protected override void OnBar() 
    {

    var eurjpy = MarketData.GetSymbol("EURJPY");
    var usdjpy = MarketData.GetSymbol("USDJPY");
    var gbpjpy = MarketData.GetSymbol("GBPJPY");

 

    Trade.CreateBuyMarketOrder(eurjpy , 10000);
    Trade.CreateBuyMarketOrder(usdjpy , 10000);
    Trade.CreateBuyMarketOrder(gbpjpy , 10000);

     }

 

2. If I would like to open a position with Label with a specific robot, then I can do it so:

    protected override void OnBar() 
    {

    var requestBuy = new MarketOrderRequest(TradeType.Buy, 10000) 

{Label = "JPY"};
    Trade.Send(requestBuy);

     }

But how can I open positions in different currency pairs with Label within a specific robot? In other words, how can I combine the two different cases?

Thanks in advance!


@rkokerti
Replies

Spotware
11 Oct 2013, 12:49

Use a Request as in the second case and add the specific symbol.

/api/requests/marketorderrequest/symbol


@Spotware