Click here to Login





                                                   NaN error in Dynamic Position Sizing MM object

  0

0
Kiran
2016-02-24 18:46:46


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.

ts = Data.ParseFormula("a = pow(1/stddev(close,"+period+"),0.5);").GetTimeSeries(pos.Symbol, "a");
Divers.Output("Symbol: " + pos.Symbol+"Sq-rt(1/Stdev): "+ts[0]);





Dynamic Position Sizing (by clonex, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

QuantShare
2016-02-25 02:41:20

  0

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.

Formula:
a = pow(1/stddev(close,"+period+"),0.5);



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Dynamic Position Sizing
Fixed Fractional Position Sizing
Trading System Template: Position Sizing Techniques
Volatility-based Position Sizing Method with Adjustable Parameter...
Fixed Risk per Trade - Position Sizing

How-to Lessons
How to create a volatility-based Stop - Dynamic stop based on the...
How to draw an horizontal segment line using QS language
How to create a real-time watchlist
How to create a watchlist
How to quickly add several positions to your portfolio

Related Forum Threads
Enhanced Dynamic Position Sizing money mgmt - some issue
Dynamic Position Sizing
dynamic position sizing based on stocks selected by the buy rules
Dynamic Position
Simulation/Back testing - Default position sizing method

Blog Posts
Dynamic Position Sizing in your Trading System
5 position sizing techniques you can use in your trading system
Troubleshooting a Trading System
The Ultimate Guide to Create Trading Systems in QuantShare
QuantShare Trading Software: New Features in the 3.1.2 Version









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



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.