Click here to Login





                                                   Using Drawdown in sell rules

  0

0
F Mazandarany
2010-12-15 15:02:56


I'm trying to use "drawdown" in a sell rule, as follows:

nasdcomp = GetSeries("_NASDAQ_52WK_His_LOs", close) ;
// Buy rules
Rule1 = nasdcomp >= 0.0 ;
buy = Rule1;
// Sell rules
Rule2 = nasdcomp <=-30 and drawdown<=-10;
sell = Rule2;

I get an error bar under "drawdown<=-10;" .....what is the cause of the error? It works correctly without the drawdown portion, but there must be a way to add a drawdown condition for the sell rule.



QuantShare
2010-12-16 04:25:31

  0

The "drawdown" variable is unknown.

Instead, you can use a 10% trailing stop.

It is not possible to calculate the drawdown in the formula because the formula generates signals only and it doesn't know which trades were taken and at which price. The only way to create a drawdown like this is to use the Money Management script.



F Mazandarany
2010-12-16 09:52:36

  0

Thanks, Could you help with the MM script to do this?


QuantShare
2010-12-17 04:04:48

  0

Best Answer
I have created a drawdown function that you may find useful: Drawdown Since Trading Signal

For the MM Script, add the following code in the "OnEndPeriod" event and remove your "sell" formula:

string sellrule = "nasdcomp = GetSeries('_NASDAQ_52WK_His_LOs', close);a = nasdcomp





Drawdown Since Trading Signal (by QuantShare, 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

F Mazandarany
2010-12-17 12:18:07

  0

Hi:
you are very helpful, 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
Trading rules using the VIX Index
Simple pattern detection rules using close and open prices
Trading Rules using Trend Indicators
Trading Rules to use with the Trading System Optimizer
Maximum Drawdown Indicator

How-to Lessons
How to perform a basic quantitative analysis using the S&P 500
How to create trading rules based on Put and Call volume data
How to plot a stock using different periods in the same chart
How to calculate the average of a time series using the money man...
How to debug a trading system using the money management tool

Related Forum Threads
Buy and Sell rules combination in Optimizer.
Buy-sell rules using a composite
Buy Sell Signals Chart Layout
Rules manager - comparing results - back testing vs rules analysi...
Better Plotting for Sell Arrows on Chart

Blog Posts
Forecast volatility using trading rules and neural networks
Trading System: Moving average crossover and few others buy and s...
How to create buy and sell trading rules based on News Data
How to use date components in your trading rules
Create indicators, composites and trading systems using QL and CS...









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.