The Problem: Grid trading trades forward, without looking at the past.
The Solution: Pivot Point Grid Trading.
Pivot Point Grid Trades take into account the days pivots and attempts to build a grid out of those pivots. Why does this work? Pivot points are based on the last day prices and are a good indicator of daily support/resistance of an instrument.
The basic concept of the Python functions to create a Pivot table, then split that table into multiple parts. This gives us a “smart” grid to open and close trades from. The example below will create a mid point and 2 other grid lines in between each Support/Resistance pivot. It expects that you have a Data frame with the pivots already setup as fields and a price entry to have something to compare the pricing to. It then returns the price of the lower line which can be used as a limit price when automated trading.
If you have any questions or comments, I will do my best to address them.