Click here to Login

Trading Software Trading objects Features How-to Blog Search


                                                   Advance Money Management Script debug.

  0

0
tdtran
2010-05-27 08:38:48


Hi,

I want to get the minimum close value of a position in the OnEndPeriod event.

I think this can be done by something like

double maxClose = pos.GetValueFromFormula("mc = SEARCHFOR __?__ " pos.BarsSinceEntry ") ","mc") ;

1. Could you please advise on how I can achieve this.

2. Furthermore the documentation for MMDrivers shows there is a Max and Min function,
however when I try to use these in the script, I get an error message saying they are undefined. If these function exists,
could I use these instead?

3. How would you go about debugging these scripts. I.e. can you trace the scripts as they run,
print out debug messages somewhere, or execute sub sections of the script etc.
I understand there is a Divers.Output function, but where does the output go?

cheers.




QuantShare
2010-05-27 10:39:24

  0

Best Answer
Hi,

1 - Here is how you can get the minimum close price since the position was entered:
MMPosition pos = Portfolio.GetPosition("SYMBOL");
MMParser parser = Data.ParseFormula("a = llv(close, " + pos.BarsSinceEntry + ");");
TimeSeries min = parser.GetTimeSeries("SYMBOL", "a");
double value = min[0]; // Get the last value

2 - These functions were removed; we are currently updating the documentation.

3 - To debug a money management script, use the "Divers.Output" function
Example:
Divers.Output("Min close price: " value);

Outputs can be found in the Simulator Report, under the "Details" tab.
Select a date to display the log or output you generated for that date.




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
Withdraw a Fixed Amount Every Month - Money Management
Correlation Filter Money Management Strategy
Investing in stocks using the Kelly criterion money management st...
Return per Bar Stop - Money Management Strategy
Averaging Down Money Management Strategy

How-to Lessons
How to calculate the average of a time series using the money man...
How to debug a trading system using the money management tool
How to run a screen or a watchlist from a script
How to get stocks for a particular index using the global script
How to execute a script at regular intervals

Related Forum Threads
Money Management Script variables and more
Advanced Money Management
Place a profit stop through Money management strategy
Example of Money Management
Money Management Scripting

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 a trading system









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 © 2012 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items