Jump to content

Automatically move stop once when price drops below a level


Recommended Posts

Hi. I have a trading strategy that I would like to execute but it involves moving the stop once when the price drops below a set threshold. Example: 

  • Current EURUSD price is at 10,000 (easy numbers)
  • I put down a sell working order with the level set at 9,980 and a stop set at 9,990. The price drops to below 9,980 and the order is placed.
  • As soon as the price drops further to 9,960 or below, the stop is moved close to the current price, i.e. it is moved from 9,990 to 9,965
  • Note this is a once-off move and a trailing stop won't (I don't think) give me what I need
  • I monitor the price further and tap out if it reaches a lower profit taking level 

I am achieving this currently through another rest api process that watches the price every 1 minute and moves the stop when the threshold is hit, but I would like something more automated / on the platform itself as I often miss the intra-minute movements.  I have considered a streaming approach but this can't be set up for limit setting right?  Also considered using alerts but this is not (currently) part of the rest api.  Can I achieve the above using the current IG rest api tools or even 3rd party tools?  Thanks!

Link to comment
On 30/03/2021 at 17:35, wki said:

Hi. I have a trading strategy that I would like to execute but it involves moving the stop once when the price drops below a set threshold. Example: 

  • Current EURUSD price is at 10,000 (easy numbers)
  • I put down a sell working order with the level set at 9,980 and a stop set at 9,990. The price drops to below 9,980 and the order is placed.
  • As soon as the price drops further to 9,960 or below, the stop is moved close to the current price, i.e. it is moved from 9,990 to 9,965
  • Note this is a once-off move and a trailing stop won't (I don't think) give me what I need
  • I monitor the price further and tap out if it reaches a lower profit taking level 

I am achieving this currently through another rest api process that watches the price every 1 minute and moves the stop when the threshold is hit, but I would like something more automated / on the platform itself as I often miss the intra-minute movements.  I have considered a streaming approach but this can't be set up for limit setting right?  Also considered using alerts but this is not (currently) part of the rest api.  Can I achieve the above using the current IG rest api tools or even 3rd party tools?  Thanks!

I don't see why you couldn't use the steaming API to watch the price and the REST API to move the stop. 

If your problem is that you would like to act quicker between minutes just watch the price setting up the streaming service and then when the threshold is hit call the REST API to update the stop. You have already most of the work done.

Link to comment

Ok great, so I can use the streaming api for this.  Assuming I can do this over multiple forex pairs?  I have the streaming api working in that I have been able to print to screen in Python but have hit a bit of a block going beyond that, wasn't sure if it was possible. Any resources you can recommend on how to do this? I'll look myself but if you have anything at your fingertips, that would be 👍

Thanks!

Link to comment
1 hour ago, wki said:

Ok great, so I can use the streaming api for this.  Assuming I can do this over multiple forex pairs?  I have the streaming api working in that I have been able to print to screen in Python but have hit a bit of a block going beyond that, wasn't sure if it was possible. Any resources you can recommend on how to do this? I'll look myself but if you have anything at your fingertips, that would be 👍

Thanks!

You can subscribe to multiple epics with the streaming service, once you get your updates it will be per epic. You should hold a collection of epics and its prices in memory , then act on every price update.

1. Subscribe to prices. (Streaming service)

2. Subscribe to trades. (Streaming service)

3. Hold your positions locally in a collection (Get the first snapshot from the REST API)

4. Set your thresholds per epic in a another collection.

5. Wait for a price update (Streaming), on that update check your positions and thresholds. Once you reach a level call the Rest API to move the stop.

6. You will get an update from the Trades streaming service, update your positions collection in that update.

If you can share your code on Github I can have a look when you have something set up.

Edited by jlz
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • General Statistics

    • Total Topics
      23,624
    • Total Posts
      97,007
    • Total Members
      44,187
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    DVB
    Joined 05/12/23 10:04
  • Posts

    • Dive into DAX's record-breaking run, fuelled by Eurozone inflation easing. Explore market dynamics, technical analysis, and potential risks.   Source: Bloomberg   Indices Inflation DAX Eurozone Technical analysis Interest  Tony Sycamore | Market Analyst, Australia | Publication date: Tuesday 05 December 2023 05:46 Last week marked a historic fifth consecutive gain for the DAX, echoing patterns not seen since October 2022. The DAX’s gains last week were supported by a Eurozone inflation report, which showed inflation eased to 2.4% in November, its lowest level since July 2021. Core inflation fell to 3.6% in November from 4.2% in October. With disinflation in Europe playing out much like in the US, it's no surprise that the European interest rate curve is pricing in five 25bp ECB rate cuts by the end of 2024. The UK rates market isn’t quite as excited about BoE rate cuts. Although headline inflation has fallen from 10.7% to 4.6% last month, core inflation at 5.7% is still too high. This explains why the UK rates market is pricing in just two and a half BoE rate cuts in 2024. The contrasting inflation and interest rate outlook between the Eurozone and the UK helps to explain why the DAX gained 9.41% in November while the FTSE gained only 1.8% during the same time. FTSE daily chart   DAX technical analysis Like its US counterpart, the S&P 500, the DAX has gotten very close, but thus far, failed to break above its year-to-date highs. As viewed on the RSI, the DAX is at extremely overbought levels, and while we remain bullish into year-end, we would not contemplate opening fresh longs at these levels. Instead, we would prefer to use dips back towards support at 16,100/16,000, looking for the DAX to retest and break above the 16,615 July high in the weeks ahead. Aware that a sustained break below the support of the 200-day moving average at 15782 would warn that the rally has run its course and that a deeper pullback is underway. DAX daily chart   Source: TradingView Source Tradingview. The figures stated are as of 5 December 2023. Past performance is not a reliable indicator of future performance. This report does not contain and is not to be taken as containing any financial product advice or financial product recommendation.     This information has been prepared by IG, a trading name of IG Markets Limited. In addition to the disclaimer below, the material on this page does not contain a record of our trading prices, or an offer of, or solicitation for, a transaction in any financial instrument. IG accepts no responsibility for any use that may be made of these comments and for any consequences that result. No representation or warranty is given as to the accuracy or completeness of this information. Consequently any person acting on it does so entirely at their own risk. Any research provided does not have regard to the specific investment objectives, financial situation and needs of any specific person who may receive it. It has not been prepared in accordance with legal requirements designed to promote the independence of investment research and as such is considered to be a marketing communication. Although we are not specifically constrained from dealing ahead of our recommendations we do not seek to take advantage of them before they are provided to our clients. See full non-independent research disclaimer and quarterly summary.
    • Stocks continue to trim the gains made in November. Following a lower session on Wall Street, Asian indices came under pressure. The Nikkei hit a three-week low, while the Hang Seng index touched a fresh one-year low as funds continued to flow out of Chinese indices. The RBA left rates unchanged, and the dovish tone of the statement caught some by surprise. It said that future rate changes would depend on data. In China the Caixin services PMI hit a three-month high of 51.5, but this did little to boost sentiment towards Chinese stocks. European and US markets are expected to open lower, ahead of the US ISM services PMI, and as the focus turns to the monthly US job reports this week.  
    • Lisk goal of onboarding 100m users into crypto and web3 will undoubtedly aid the adoption of Web3 and cryptocurrency industry. By offering an accessible blockchain application platform and an industry leading JavaScript SDK, it won't be long before this is achieved 
×
×
  • Create New...
us