Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Parabolic SAR strategy #246

Merged
merged 5 commits into from
Jun 9, 2017
Merged

Parabolic SAR strategy #246

merged 5 commits into from
Jun 9, 2017

Conversation

carlos8f
Copy link
Contributor

@carlos8f carlos8f commented Jun 8, 2017

@DeviaVir adding back the SAR strat, tweaked the settings a bit and getting good sim results:

the-batcomp:zenbot morpheus.5250$ zenbot sim gdax.eth-usd --days 10 --strategy=sar --period=1m
2017-06-08 12:11:28  253.73 ETH-USD   -0.1%       14    --        -0.06%   bought  9.79 ETH    24.84 USD  +150.9%  +73.5%
{
  "asset_capital": 0,
  "buy_pct": 99,
  "buy_stop_pct": 0,
  "currency_capital": 1000,
  "days": 10,
  "markup_pct": 0,
  "max_sell_loss_pct": 25,
  "max_slippage_pct": 5,
  "min_periods": 52,
  "mode": "sim",
  "order_adjust_time": 10000,
  "period": "1m",
  "profit_stop_enable_pct": 0,
  "profit_stop_pct": 1,
  "rsi_periods": 14,
  "sar_af": 0.025,
  "sar_max_af": 0.55,
  "selector": "gdax.ETH-USD",
  "sell_pct": 99,
  "sell_stop_pct": 0,
  "start": 1496016000000,
  "stats": false,
  "strategy": "sar",
  "verbose": false
}
end balance: 2511.68408604 (151.17%)
buy hold: 1447.50940385 (44.75%)
vs. buy hold: 73.52%
2011 trades over 11 days (avg 182.82 trades/day)
win/loss: 966/1045
error rate: 51.96%

It seems to work best with aggressive trading, so would probably only be an option for 0% fee exchanges.... currently testing this on GDAX with parallel paper trading to see if 1m period is practical.

@carlos8f carlos8f changed the title Sar Parabolic SAR strategy Jun 8, 2017
Copy link
Owner

@DeviaVir DeviaVir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, but I'm wondering if it's feasible at all with 2011 trades over 11 days (7 trades an hour): GDAX fills can take a while or not be filled at all if you're using limit orders..
Still, I think it's good to have this strategy.

Could you also update the README.md with this new strategy?

Copy link
Owner

@DeviaVir DeviaVir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tracking readme changes for this in #247 instead

@DeviaVir DeviaVir merged commit 1f5a50d into master Jun 9, 2017
@carlos8f
Copy link
Contributor Author

@DeviaVir Ran it for 27 hours on gdax.ETH-USD, and after 140 trades,

  • I got +4.7% profit, -3.2% under buy/hold.
  • Paper trading yielded +5.8% profit -2.0% under buy/hold.
  • Sim showed +10.39% profit, 2.13% over buy/hold.
  • Avg real slippage was 0.045% (vs. 0.25% of a market order + slippage)
  • Avg real execution time was 129s

Overall I'm pretty happy with the result, real trading with 1m period was still profitable, although a little worse than the paper/sim versions. Slippage was not too bad, definitely worth the 2m execution time vs. taking a fee. Some fixes I recently did to the order execution seem to have payed off 👍

@carlos8f
Copy link
Contributor Author

also note that I used 5s order_adjust_time and 5s poll_trades without any issues. I might make 5s order_adjust_time the new default since it already checks the order's bid every 5s anyway.

@DeviaVir
Copy link
Owner

@carlos8f been giving SAR a go, but I ended up with: +7.6% -17.0% after a few days. Granted, I can't do USD market so that might influence this result greatly.

@talvasconcelos
Copy link
Contributor

Giving SAR also a try started now on poloniex.str-usdt with default settings. i'll report on how it has done. I'm getting Nounce error a lot and maybe it's because polo API is choked!!

@apthomas
Copy link

Has anyone tried live trading when using SAR with a shorter period than 1 minute? I simulated with 30 seconds as the period and saw large improvements in the results.

Additionally were you seeing problems with orders being filled when live trading? what seems to be the best max_slippage_pct for gdax.BTC-USD?

@typicalaimster
Copy link

@apthomas, yes I've set mine to 30 seconds. Sometimes it works good. Othertimes it doesn't. If you're using maker with GDAX you'll find the buy/sell process kills your results.

@apthomas
Copy link

@ typicalaimster. Does that mean your profits on average outweigh the costs of the taker fee? That seems nearly impossible because of the number of trades that SAR performs...I'd think the only way to trade SAR would be as the maker so you don't pay fees.

@typicalaimster
Copy link

typicalaimster commented Jul 25, 2017

@apthomas.. When you do a test what is your average slippage set to? From what I've seen... From the time the bot initiates a buy/sell to the time it's bought/sold the "slippage" is huge. For me it's greater than the default of 0.045%. Meaning, the bot triggered a buy at $200, but didn't get a buy until $202. Then on the inverse.. You might hit $202.50. The bot triggers a sale. However it's not able to sell until $199.75. At which point I'm under water. If you go back and run sims with a real life average slippage, it tells a different story.

FWIW GDAX allows you to mix/match Maker/Taker. You can comment out the 'taker' lines (137-141) in exchange.js and have it buy as a maker and sell as a taker. That way you're only getting dinged with the fee on the sell. I'm surprised no one has created a setting and called it raker or soemthing.

@VertigoRay
Copy link

@typicalaimster Really you'd want to put in a sell order with a stop-loss which GDAX also allows you to do. The stop-loss should still be above your original buy price. Then you only take a fee to save your skin.

@simonfr
Copy link

simonfr commented Sep 25, 2017

After 24h of use. I get -4.08% and price of ETH up of +3.05%

@evseevnn-zz
Copy link
Contributor

@simonfr You using backtest utility before trying this strategy?

supersabbath pushed a commit to supersabbath/zenbot that referenced this pull request Oct 2, 2017
* experimental sar strat

* fix sar description

* default 1m period for sar

* sar indicator grey

* less noisy "vs our price" debug msgs
@janus007
Copy link

I'm just so happy with your usage.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants