Click here to Login





                                                   Is there a way to divide a money management event into functions?

  0

0
Chaim6
2014-10-05 13:28:11


I would like to divide my script into a few functions for the sake of simplicity. Is there a way to do this?

My money management script for the OnEndPeriod is already over 100 lines of code and counting. In the interest of clean, readable, error free code the experts from Google programming (who are considered from the best in deciding good programming practices) suggest that functions should rarely go more than 40 lines. More than about 40 lines becomes complex. If some of the best programmers in the business find it simpler then certainly for me it's better.

Thanks.



QuantShare
2014-10-06 02:39:58

  0

Best Answer
Sure you can do that.
You can create functions directly in the "Global" event (These functions can be used in any other event) or you can create functions under any other event (in that case, you must precede the functions by #functions# keyword)

Example:
#functions#
public void MyFunction()
{
}





Chaim6
2014-10-06 09:13:03

  0

Thank you!


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
Money Management System to Split Order Into Smaller Pieces
Return per Bar Stop - Money Management Strategy
Long strategy created with the money management tool
Money management to Reject Trading Positions Based on their Past ...
Investing in stocks using the Kelly criterion money management st...

How-to Lessons
How to debug a trading system using the money management tool
How to calculate the average of a time series using the money man...
How to import trades into a portfolio
How to import your own list of stocks/symbols
How to get stocks for a particular index using the global script

Related Forum Threads
Money Management Scripting
Get the Previous N bar Date/DateTime in Money Management script
Money Management to read future values (e.g. next day open)
Advanced Money Management
Backtesting: Using lookback money management feature

Blog Posts
Basic trading system implemented using the money management tool
Several money management strategies in a trading system
Create a trading strategy using the money management tool - Part ...
Create a trading strategy using the money management tool - Part ...
Money Management: Optimize the scale-in strategy









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.