Jump to content

Search the Community

Showing results for tags 'buy'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Gain Capital API FAQ
    • General Questions and Discussion

Found 1 result

  1. Hello, This is my first post on this forum :-) I am working with the API, through a demo account, and have created a buy limit order (order/newstoplimitorder) with a corresponding sell stop/limit. Here is my JSON: { "MarketId": 401484347, "AutoRollover": false, "Direction": "Buy", "Quantity": 10000, "PositionMethodId": 1, "BidPrice": 1.18175, "OfferPrice": 1.18187, "TriggerPrice": 1.18237, "TradingAccountId": XXXXXXXXX, "IfDone": [ { "Stop": { "TrailingDistance": 10, "Direction": "SELL", "Quantity": 10000 } }, { "Limit": { "TriggerPrice": 1.18449, "Direction": "SELL", "Quantity": 10000 } } ] } The "problem" is that the Stop/Limit orders need to be OCO orders because after the Buy order goes through, both of these orders are submitted. Once one has completed the other one stays out there. That's why they need to be OCO. I know this can be done because I am able to create that scenario through the tradingview web site. My questions is how can this be accomplished? I have tried several combinations of IFDone and OcoOrder to no avail. A working JSON example would be perfect! An explanation would work also. Thanx in advance!