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
  • image.png

  • Posts

    • after last weeks sell off'  a chart showing price in a possible discount & at a previous level of interest 
    • Solana ($SOL) is facing a challenging period in the market, with its price dropping to $130.56 USD. Here’s a closer look at what’s happening and what might be next for SOL. Recent Price Decline 15.17% Drop in a Month: Over the past month, Solana coin has fallen by 15.17%. This decline reflects the broader market’s pressure on the cryptocurrency. 8.5% Weekly Fall: Just this week, Solana saw an 8.5% drop, a sign that bears are firmly in control. Despite attempts to maintain a bullish outlook, the market seems to have different plans. Critical Support Levels Breakdown of $134 Support: Recently, SOL broke through the $134 support level, raising concerns that further declines could be on the way. Key Support at $122: The $122 level is now under the spotlight. This price point has been tested six times, and many whales view it as crucial. A break below this could push SOL towards $90. But if this support holds, it might set the stage for a bullish turnaround. $100 Support: While the $100 support level is still a bit distant, it’s essential to watch if the current bearish momentum continues. Revisiting this level could spell trouble for Solana. Changing Market Sentiment Shift to Bearish: The overall sentiment around Solana is slowly turning bearish. Since March, SOL has struggled to make new highs, and the current price action suggests that new lows could be coming. Potential Bullish Outcome: However, some analysts believe that if Solana manages to stay above $122 throughout 2024 and 2025, it could be incredibly bullish for the future, possibly leading to significant gains in 2025. Upcoming Breakpoint Event Historical Price Surges: There’s a potential catalyst on the horizon. Historically, Solana has seen price surges two weeks before its annual Breakpoint event. In previous years, SOL surged by 35% in 2021 and 2022, and by 60% in 2023. 2024 Event: With 16 days left until the 2024 Breakpoint event, could we see another rally? Only time will tell. The Importance of $122 Support As Solana approaches the $122 support level, all eyes are on whether it will hold. A break below could lead to further declines, while maintaining this support could bring back some bullish momentum. As always, stay informed, and remember the old adage in crypto: "buy the rumor, sell the news." Keep watching the charts as we near the 2024 Breakpoint event.  
    • One of the prominent cryptocurrency exchange, has maintained its commitment to user security through its Protection Fund. This self-insured fund, designed to safeguard user assets against potential threats such as hacks, fraud, and market volatility, has shown remarkable stability and growth. The fund has consistently maintained a value above $390 million, surpassing Bitget's initial commitment of $300 million. The exchange ability to continues to maintain a reserve ratio well above 150%, indicating a strong buffer against potential risks. The fund's value has shown correlation with Bitcoin's price movements, demonstrating its responsiveness to market conditions. Over the observed period, the fund's value peaked at $424.8 million and reached a low of $350.7 million, showcasing its ability to withstand market volatility while maintaining a substantial baseline. In February, the fund reached an all-time high valuation of over $543 million, coinciding with broader market uptrends. The Protection Fund's portfolio includes high-liquidity cryptocurrencies such as BTC, USDT, and USDC, which contributes to its stability and liquidity. This diversification strategy aims to mitigate risks associated with external market factors. Bitget's approach of self-funding and internally managing the Protection Fund allows for potentially quicker response times in critical situations, as it operates independently of external regulations and approvals. As the cryptocurrency market continues to evolve, the performance and management of such security measures will likely remain a point of interest for both users and industry observers.
×
×
  • Create New...
us