Back

Trouble with implementing slippage

Does anyone have a good tutorial of implementing slippage? I've tried invoking it as a Transaction Model but it complains about it not being a correct cast. Are we not allowed to do this?

Securities["VXX"].TransactionModel = new ConstantSlippageModel(0.001m);

Thanks.

Update Backtest








A transaction model is a combination of a fee model/fill model/slippage model all in one type. The constant slippage model needs to be assigned to the SlippageModel property instead of the TransactionModel property.Securities["VXX"].SlippageModel = new ConstantSlippageModel(0.001m);
Here's the Security class with the various models that can be set.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This is great, thanks Michael.
0

I had an additional message here about how I couldn't get it to work, but I simply had forgotten the namespace. Thanks!

1

For others with a similar issue, you'll need to add a using statement at the top of the code file:using QuantConnect.Orders.Slippage

1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


I've set the slippage and I'm not seeing an effect on the backtest results...

for(int i=0;i AddSecurity(SecurityType.Equity, tickers[i], Resolution.Minute);
Securities[tickers[i]].SlippageModel = new ConstantSlippageModel(0.10m);
Securities[tickers[i]].TransactionModel = new ConstantFeeTransactionModel(1);
}

Is the above not the way to set it?
0

I don't know why the code didn't copy well...


for(int i=0;i tickersl.Add(tickers[i]);

AddSecurity(SecurityType.Equity, tickers[i], Resolution.Minute);
Securities[tickers[i]].SlippageModel = new ConstantSlippageModel(0.10m);
Securities[tickers[i]].TransactionModel = new ConstantFeeTransactionModel(1);

}
0

If a transaction model is a combination of slippage, fill, and fee models then this:

Securities[tickers[i]].TransactionModel = new ConstantFeeTransactionModel(1);

might be overwriting this:

Securities[tickers[i]].SlippageModel = new ConstantSlippageModel(0.10m);
0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed