AugurWorks / Engine

http://engine.augurworks.com/
MIT License
2 stars 0 forks source link

Automation Rules #120

Closed augurworks1 closed 6 years ago

augurworks1 commented 6 years ago

Beginning with getting some thoughts and observations down. The goal is to provide Buy, Sell and Hold signals based on intraday numbers, currently on the 30 min interval, but could change.

Buy: Both intraday numbers are above the market line. For example, the 1100 run will include the 1100 close number and the 1130 30 minute real time number. If both of these numbers are above the 1100 market number, then it is a buy signal

Sell: Both intraday numbers are below the market line for the time interval.

Hold:

  1. At least one intraday number is the same as the market value for the time interval, regardless of the other intraday value.
  2. One intraday number is above the market number and one intraday is below the market number for the time interval

Thresholds: Currently, I'm using a 1/10% threshold of the intraday number compared to the actual market. That is, for a buy/sell action, both intraday numbers must be greater than a 1/10% from the actual market number to take action. If one intraday number is less than 1/10%, it is considered the same as the actual market number and no action is taken since the overall action is considered a hold. The threshold should be configurable

Other: I believe there is a 'rate of change' or 'momentum' aspect we may need to account for. The problem to solve is the intraday real time and close numbers split the actual market value, but the market is changing rapidly. Using the rules above, it would be considered a hold. If the market is moving in the direction of our position (going down for a short position), the rule is true. However, it poses a potential risk if the market moves against our position. The signals will mostly like correct themselves in the next run, but has the potential for a loss as we've experienced.

Another option could be to run the model at the 15 minute point to get additional insight instead of waiting 30 minutes if there is a sharp change. This approach could be an exception based while doing it manually. I think continually running every 15 minutes would be overwhelming currently.

augurworks1 commented 6 years ago

More thinking... Each model should be individually configureable for the threshold. Also, we may need a couple of values per model based on the previous run. For example, We use a threshold of $4 for the S&P, .15%, from the current market value to trigger a move. The problem is on days the market just ticks upward or downward, we never hit the trigger, even though there's a clear trend. I'll do more analysis, but the scenario would be something like; if the previous 2 runs moved the same direction by $2, then we adjust the threshold to $2 for the next run instead of the normal $4 for the S&P.

augurworks1 commented 6 years ago

DON'T DO THIS:

Adding a new rule to document it.

If the both models (rt and close) change more than .25% from those of the previous run, take or change (flip) position, even if the models aren't at there normal limits. This indicates a sharp market change that we need to take action. This is particularly important on days where the market is choppy and making significant moves in a short amount of time.

augurworks1 commented 6 years ago

More rules:

Adding a rule to compare the change in models from the previous run. This appears to be a very good indicator of market direction change. Additionally, when combined with the previous buy-sell-hold indicators of the models changing above or below the actual market, it is a very good indicator of taking a position

1) Take a position:

Both RT and Close have changed for than .25% (current value) from the previous run AND the RT and Close models are above/below the normal buy-sell-hold thresholds, then take action.

2) Getting out of a position:

(Needs more testing) In most cases, follow the above rules. However, if the market is moving fast, the normal rt and close may be slower than the market. In this case, if the change in both models from the previous run are over the current .25% threshold, then get out of the position. The worst case is we leave some money on the table.

augurworks1 commented 6 years ago

Adding on to above:

Performed testing using various scenarios to maximize P/L:

Our current MO works fairly well. The main issues are we just can't seem to trade fast enough on sharp moving changes or get the proper signals on slow trending markets. This led me to perform other testing. The scenario's tested were:

1) Current MO (with and without accumulating change predictions from the previous run). 2) Use only RT buy/sell (raw) and both change models over threshold 3) Use only RT buy/sell and both change over threshold to take a position, but only RT change to get out of a position 4) Use just change prediction signals, not raw predictions 5) Use RT signals only. This includes the raw buy/sell prediction and the change prediction model from the previous run 6) Same as 5, but increasing RT change thresholds to 20 and 9 for the Nasdaq and S&P, respectively. The current values used are 15 and 7. 7) Same as 6, but with accumulated change from previous change model. The accum change is used IFF there is a hard buy/sell from raw prediction AND change is the same direction but under threshold, AND the sum of the current change and the previous change are over the threshold.

Scenario 7 maximized P/L for both nasdaq and s&p using the test models. Actually, increasing change threshold number for the current "normal" scenario (item 1) improved P&L. In practice, the tendency is to lower this number, which doesn't work as well. Scenario 6 was the 2nd best model and only didn't maximize P&L in one test, although still positive P/L.

What this approach tends to do is eliminate the "chatter" on busy days and allows for a good signal on slow, one-way trends since the RT prediction is much more sensitive than the close number. This also causes larger variances in the change signal. Used together seems to be the best usage model to act on the predictions. Lastly, it minimizes trades (positions taken), which is another benefit.

On paper, the current MO works well as noted above. However, in practice doesn't appear to work as well as using the RT only across many market behaviors.

TheConnMan commented 6 years ago

I'll add a second upper/lower threshold for checking the previous period prediction against the current period prediction. If this and the current prediction threshold are met and match we'll recommend a buy or sell.

augurworks1 commented 6 years ago

Here's an additional rules I'm testing in conjunction with above. Item 2 below is also looking at the total change. that is the change in market AND the change in prediction. I believe you're planning to pull the current and previous for both the market and prediction.

Still testing, but looks good so far.

NDX: 1) Change is 20 and RT is 5 OR 2) Total of change and RT is 25 and RT is 10

SPX: 1) Change is 9 and RT is 2 OR 2) Total of chance is 11 and RT is 5

augurworks1 commented 6 years ago

Ok, so we had to include the Close model back into the equation. Here is what I'm following that has been tested on 2 weeks of data.

Threshold Rules:

RT and Close predictions must be 3 or over the current market at the time of run. AND RT and Close CHANGE must be 5 or over from the previous runs

Variances from above (Overrides):

1) Take Action: Trend - For the change in Close value, the change 2nd consecutive run in the is in the same direction and has a value of 10 or more.

2) No action: Ignore RT changes over.35% on a single run. Generally occurs during the first 2 or 3 runs of the morning, but can occur during the day. In this case it’s usually an anomaly.

3) No action: Ignore immediate changes in direction (next interval) that meet threshold rules. This is related to swings in the opposite direction.

TheConnMan commented 6 years ago

Implemented in https://github.com/AugurWorks/Engine/releases/tag/v3.10.0.