Click here to Login





                                                   Advance Money Management Script debug.

  0

0
Trading Software
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 and exit options in the wizard
Can a Money Management script access a custom function?
Get the Previous N bar Date/DateTime in Money Management script
Money Management Script variables and more
Money management script help - Targeted net profit per day

Blog Posts
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 ...
Basic trading system implemented using the money management tool
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.