I'm altering the volatility-based sizing formula in the Dynamic Position Sizing MM object so it allocates size proportional to the square-root(inverse(volatility)) instead of based on volatility.
See formula below - it compiles fine, but i get a NaN Divers output when debugging and the backtest yields no trades.
- how do i correct the formula so that it computes a finite number for the sizing.
You need to check your formula (on a chart for example) and why it is returning (NaN - Not a number). Maybe at that date, there were not enough bars to calculate the stddev.
Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.