Implementing Trade State Tracking System
Budget: $30 – $250 USD
So what’s happening is I have a scapling strategy that mostly focuses on the emini S&P. The average spread of the S&P is .25 which is 1 tick value. So what’s happening is, for example, say I’m going to go short at the bottom of a red box(see image) ...price comes up and the last(market) price trades at the bottom of the red box however, it sets a limit order at the bottom of the red box to go short, but because of the spread the bid, .25, is below the low of the red box price begins to move down with no executed short trade and when it gets to what should be the take profit price it triggers a long order.
Now that long order is what I call a "rogue trade" and it has no trading parameters and will continue to stay open until somewhere on the chart it gets an exit. Worst yet it continues down and ends up triggering more buy trades and instead of being an elite trade it can end up running rouge and blow an account. See live example images.
So in order to prevent that I need a checking condition. I don’t want to enter that rouge long trade unless that short trade actually got executed first.
The opposite is true for long trades.
There’s also another scenario where the short trade for example, did get executed, but when it goes down to the take profit zone, the last price (market) trades there and set a limit at the take profit price, but then price moves away and because of the spread again we never get an exit out of the short trade.
So that’s why we need this conditional checking.
Image example: you can see the short limit order got set but not executed! But the algo then moves down fast and executes the long trade that should have been the 'exit' of the short trade, you can see how this trade progressed and became worse.
What I need:
To address the issue of a random executed trade occurring when the short trade doesn't get filled but the price moves to the take profit level, causing an unintended long trade, we need to implement a check to ensure that trades are only executed if the initial position was filled.
Solution: Trade State Tracking:
Implement a mechanism to track whether the initial short trade was successfully filled before allowing any subsequent trades (such as the take profit).
Conditional Execution:
Use a conditional check to ensure that the take profit or exit orders are only placed if the initial short position exists
Now that long order is what I call a "rogue trade" and it has no trading parameters and will continue to stay open until somewhere on the chart it gets an exit. Worst yet it continues down and ends up triggering more buy trades and instead of being an elite trade it can end up running rouge and blow an account. See live example images.
So in order to prevent that I need a checking condition. I don’t want to enter that rouge long trade unless that short trade actually got executed first.
The opposite is true for long trades.
There’s also another scenario where the short trade for example, did get executed, but when it goes down to the take profit zone, the last price (market) trades there and set a limit at the take profit price, but then price moves away and because of the spread again we never get an exit out of the short trade.
So that’s why we need this conditional checking.
Image example: you can see the short limit order got set but not executed! But the algo then moves down fast and executes the long trade that should have been the 'exit' of the short trade, you can see how this trade progressed and became worse.
What I need:
To address the issue of a random executed trade occurring when the short trade doesn't get filled but the price moves to the take profit level, causing an unintended long trade, we need to implement a check to ensure that trades are only executed if the initial position was filled.
Solution: Trade State Tracking:
Implement a mechanism to track whether the initial short trade was successfully filled before allowing any subsequent trades (such as the take profit).
Conditional Execution:
Use a conditional check to ensure that the take profit or exit orders are only placed if the initial short position exists