Back

Forex Risk Manager implementation

This forex risk manager is based in the work made by @Deval Keralia in this post. I even copied its Volatility model!

The strategy itself is a simple moving average cross, so is not even a strategy, is just a framework to show the Risk Manager.

The risk manager checks three condition before estimate the entry quantity.

  • The max risk per trade
  • The max exposure per trade
  • The max exposure in all open trades.

And returns two values, the entry quantity and the stop-loss price. The risk manager also implements a trailing order for the stop-loss orders.

I made this testing algorithm for the risk manager class, just in case you want to check it.

If you have some ideas about how to improve it or just some thoughts, I’d love to hear them.

 

P.S. yeah I know the 2 Sharpe is a clickbait, but maybe without it, you wouldn't read this post at all ;)

 

Update Backtest






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 would prefer an 85% win to 15% loss ratio!
0

anyone haveing problems with posting new discussions?
0

You've posted 2 threads already. You sure you selected "Newest" rather than "Trending"?

0

Thanks for the help!
0

C'mon guys! 61 clones and nobody has nothing to say?

Ideas, implementation improvements, constructive and destructive criticism are accepted!
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.


var ticket = MarketOrder(pair, entryValues.Item1);
StopMarketOrder(pair, -entryValues.Item1, entryValues.Item2);

 

This code requires mad "buying power". When in RL our broker would allow us to do this as one clean StopLossOrder.

1

Hi Ian, thanks for your feedback.

Why do you say the algorithm requires mad "buying power"?

I made a simple try in the attached backtest o check if by submitting a StopMarketOrder the margin decreases, but no.

Here is the attached backtest Log:

2016-02-01 00:00:00 : Purchased EURUSD on 02/01/2016
2016-02-01 00:00:00 : Time: 02/01/2016 05:00:00 OrderID: 1 Symbol: EURUSD Status: Submitted
2016-02-01 00:00:00 : Margin Remaining : $ 10,000.00
2016-02-01 00:00:00 : Time: 02/01/2016 05:00:00 OrderID: 1 Symbol: EURUSD Status: Filled Quantity: 1000 FillPrice: 1.0848218 USD OrderFee: 2.00 USD
2016-02-01 00:00:00 : Margin Remaining : $ 8,913.18
2016-02-01 00:00:00 : Time: 02/01/2016 05:00:00 OrderID: 2 Symbol: EURUSD Status: Submitted
2016-02-01 00:00:00 : Margin Remaining : $ 8,913.18

Maybe I’m missing something. Can you please show us a better implementation?

 

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.


this thread is really helpfull for me.. would like gain and share more knowledge about forex risk manager implemantation

 

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