How can i change the default calculated Slippage for forex? currently its 0.01
//Assume slippage is 1/1000th of the price
slippage = lastBar.Price*0.001m;
QUANTCONNECT COMMUNITY
How can i change the default calculated Slippage for forex? currently its 0.01
//Assume slippage is 1/1000th of the price
slippage = lastBar.Price*0.001m;
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.
Eyal Zach
class MyForexTransactionModel : ForexTransactionModel { ///
/// Get the Slippage approximation for this order:
///
public override decimal GetSlippageApproximation(Security security, Order order)
{
//Return 0 by default
decimal slippage = 0;
//For FOREX, the slippage is the Bid/Ask Spread for Tick, and an approximation for the
switch (security.Resolution)
{
case Resolution.Minute:
case Resolution.Second:
//Get the last data packet:
//TradeBar lastBar = (TradeBar)security.GetLastData();
//Assume slippage is 1/1000th of the price
//slippage = lastBar.Price*0.001m;
slippage = 0.00005m;
break;
case Resolution.Tick:
Tick lastTick = (Tick) security.GetLastData();
switch (order.Direction)
{
case OrderDirection.Buy:
//We're buying, assume slip to Asking Price.
slippage = Math.Abs(order.Price - lastTick.AskPrice);
break;
case OrderDirection.Sell:
//We're selling, assume slip to the bid price.
slippage = Math.Abs(order.Price - lastTick.BidPrice);
break;
}
break;
}
return slippage;
}
}
I simply changed the slippage to fix .5pipJared Broad
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.
Eyal Zach
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!