Click here to Login

Trading Software Trading objects Features How-to Blog Search


                                                   Buy-sell rules using a composite

  0

0
F Mazandarany
2010-12-13 12:54:05


I have created a composite called Nasdaq 52 week highs minus 52 lows (symbol is _NASDAQ_52WK_His_LOs). I want to use this composite using the MM script to optimize for buy-sell rules as follows:

Buy SPY when composite >a
Sell Spy when composite <b
So I would be optimizing for "a" and "b".

The script for the composite is:

highs= Ticker("^52-week-highs-nasdaq",close,zero);
lows= Ticker("^52-week-lows-nasdaq",close,zero);
composite=highs-lows;

Could you please create the MM script to do this?



QuantShare
2010-12-13 13:30:24

  0

Hi,

For this, you don't have to create a MM Script.

Simply type the following formula: (And select SPY in the simulation symbols)

nasdcomp = GetSeries("_NASDAQ_52WK_His_LOs", close) ;

// Buy rules
Optimize("a", 10, 100, 10);
Rule1 = nasdcomp > a;
buy = Rule1;

// Sell rules

Optimize("b", 10, 100, 10);
Rule2 = nasdcomp < b;
sell = Rule2;


Let me know if you need the MM Script.



F Mazandarany
2010-12-13 15:02:24

  0

Thanks, this works. I tried to add a second rule to buy and sell so that in addition to the composite condition, I must satisfy an sma condition, but I get errors. Here is what I did.

nasdcomp = GetSeries("_NASDAQ_52WK_His_LOs", close) ;

// Buy rules
Rule1 = nasdcomp > 0 and close>sma(200)*1.02;
buy = Rule1

// Sell rules

Rule2 = nasdcomp < -100 and close<sma(200)*0.98;

sell = Rule2;




QuantShare
2010-12-14 04:27:40

  0

Best Answer
Note that when you put this formula, the word "Rule2" is underlined.

This means that there is an error near this keyword and the error is that you forget to add the semi-colon after the "buy = Rule1".



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
Market Volatility - Composite Indicator using Stocks Standard Dev...
Simple pattern detection rules using close and open prices
Market Composite Index based on the Sharpe Ratio
Trading Rules to use with the Trading System Optimizer

How-to Lessons
How to filter stocks in a market composite
How to create trading rules based on Put and Call volume data
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 create a composite index/indicator

Related Forum Threads
Using Drawdown in sell rules
average composite index
Can I update the sector and industry information in the stock dat...
Stock or industry relative strenght : Indicator or composite ?
FROM COMPOSITE TO TEMPORARY WATCH LIST OF MEMBERS OF COMPOSITE,BY...

Blog Posts
Create a stock index or a trading indicator using the composite t...
How to create market indicators using the composite function - Pa...
How to create market indicators using the composite function - Pa...
How to create market indicators using the composite function - Pa...
Screening with the composite indicators









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