Grid Trading for ranging markets
Forums › ProRealTime English forum › ProOrder support › Grid Trading for ranging markets
- This topic has 10 replies, 5 voices, and was last updated 4 months ago by DonTony.
-
-
07/08/2024 at 8:50 PM #234971
Hi all,
I am wondering if there is a simple grid trading code to buy and sell at predetermined levels on a chart. There was a topic many years back in 2016/17 but this was more of position building and trailing stops etc. What I am looking to do is more simple to start with. An eg:
Index is at 1,000
1) Set the grid size, say 10 points and take profit, say 10 points. Set max index level of grid operation say 900 – 1100. Set start index level of strategy ie only operates once it hits that level, say 1000.
2) Open a buy AND sell position at 1000 with a 10pt take profit
3) If Index goes to 1010 long will be closed. Enter another long and short @ 1010 with same limit.
4) OR if index goes to 9990 short will be closed. Enter another long and short at 9990 with same limit
5) And so on… Every time a grid level (ie 10pts hits) the system automatically opens another Long and/or Short at that level so that you always have one each of long and short positions at every level.
6) It only opens the relevant position so that there is a long and short remaining at each level. ie in above example if index goes from 1010 back to 1,000 then it only opens another long at 1000 as it already still has the original short open from 2)Yes, you will have to take into account spreads and the spreads will mean you are giving away money each time but this is not meant for trending markets.
And of course if the market goes in one direction only you will have increasing positions and margin to contend with. Hence parameter levels within which the strategy operates are crucial.
But this is just the first test phase where I’m testing and applying to select ranging or long/short bias markets ie ones where there is a good likelihood of this working. Am working on a filter that provides this.The premise being if an index trades within 990 -1100 for 6 mths you have 200pts to work with if you happen to be so good to time it exactly right each time. But with oscillation you can accumulate possibly many more points than this even if you end up at the same index closing level and you don’t have to try and time it as much.
Happy to share results as we go along so others can benefit. I am manually trading this on certain markets so see some potential. Can prob code this with time but I’m a bit rusty so any help appreciated !
Please ask if any questions.
Many thanks.
07/08/2024 at 9:10 PM #234972Enter another long and short @ 1010 with same limit.
Does above need Long and Short open at same time?
If Yes, we can’t do that with AutoTrading, manual yes, but not Algos, well not within the same coded Algo.You would need 2 separate Algos to enter Long and Short at same time.
Just a few thoughts.
1 user thanked author for this post.
07/08/2024 at 9:56 PM #234973Hi – Thanks for the input. Yes it has to be long and short at the same time otherwise it doesn’t work.
I was not aware you couldn’t do this in algos because as you say in manual, its allowed.
The problem with doing 2 separate algos is that they can’t “talk” to each other but I guess it could still work as all you need to do is code it like this for the long side:
1) Long at 1000
2) Limit order to buy at 990
3) Stop Limit buy at 1010
4) Those 3 implements the first set of trades/orders.
5) Thereafter every time the index reaches a multiple of 10 (or as defined), if there is no long position then open one at that level with a limit of 10Think something like that could work.
07/09/2024 at 12:29 PM #234985Pending orders can actually be both Long and Short at the same time, but if both orders are triggered, the second one will reverse closing the first trade.
1 user thanked author for this post.
07/09/2024 at 2:12 PM #234989Thanks for the confirmation. Ok so it seems that doing it in one algo is not going to work. Thats fine we’ll have to work around that and split into separate long and short.
If anyone has any input on how to develop the long only grid code as detailed above then it would be appreciated. I can then amend (hopefully!) for the short side and test out and take it from there.
07/09/2024 at 3:24 PM #234990Shuld not be to hard, as long as you use the same “zero point” both algos shuld be on the same clock.
I gess the best way would be to define a 0 and then the levels above are + and the ones below are -.
Then use a loops to define the stepps ect and put limit/stop orders depeding on wher on the grid the price is.
1 user thanked author for this post.
07/09/2024 at 6:53 PM #23499807/10/2024 at 11:13 AM #235007Ok, thanks. I’ll have a go at doing that, will try sourcing some old code from other strategies to use as a base though not sure exactly how to use the loops correctly but will try and figure it out.
I would recomend the training courses, the expert one goes over loops and how to make lines in the charts.
07/30/2024 at 10:54 AM #235925Hello Manel,
It may be silly of me, but I don’t understand how you can make money with such a strategy.
If the price rises from 1000 to 1050, it is 5x 10=50 of LONG gain. But this creates a loss of all the more on the SHORTS because entry at 1000-1050 = -50 on the SHORTS.
Maybe I misunderstood?
Do you have another explanation of your strategy to give me?
Tony
07/30/2024 at 11:22 AM #235931I think it works by using the ‘ups and downs’ of intraday trading.
If low / narrow profit targets (10 to 20 points on DJI for example) are used then, on a swing up, the Longs exit at Profit while the Shorts show a bigger Loss.
The next swing down should bring the Shorts back into profit and hopefully exit at Profit Target.
Just a few thoughts in case manel doesn’t answer.
07/31/2024 at 11:07 AM #235962Hello Grahal,
Thank you for your answer.
If I take your example, indeed during a bullish Swing, it will create gains. We will have a losing short position.
If prices do fall, the loss on the Short will be reduced, and we may end up as a gain on that position, but we will have resumed a Long trade. So the gain on the SHORT will be cancelled out by the loss on the LONG.
Frankly, no matter how much I think about it, I don’t see how I can take advantage of this strategy without taking a bigger position when a move seems to be taking shape in one direction.
-
AuthorPosts
Find exclusive trading pro-tools on