Click here to Login





                                                   Buy/Sell order types w/Simulator

  0

0
Russ
2010-09-19 20:43:10


Greetings everyone, I have just recently downloaded and starting learning the QuantShare software and am glad to join this community. I have previously used and am still using Fidelity's Wealth Lab software to backtest trading strategies.

Wealth Lab uses a single C# code editor that runs the entire backtesting process (buy/sell signals, money managment, ranking systems, ect) and moving over to QuantShare has seemed a little fragmented. I will likely have many questions in the future but try to limit them to one at a time :)

I have a basic understanding of computer programming languages and have been working with the formula editor in QuantShare's simulator. My first problem has been trying to find a way to create two different sell signals, one that uses a Sell on Close market order and another one that uses a limit order.

Thus, is there a way to program this into the formula editor or another method to use these two sell signals simutaneously???

1) Sell at Close if Close[bar] < 50 day simple moving average
2) Sell at Limit of Highest Value of last 250 days


Thanks for any help!

Russ



QuantShare
2010-09-20 06:14:56

  0

Best Answer
Welcome to our community Russ.

There are several ways to perform this. You can for example specify a common sell rule for both signals and then update the order type using the "OnClosePosition" event of the money management script.

Here is a script that changes a (default) limit order (You should specify the limit order in the order settings: Sell using limit order at the price of hhv(250))

string symbol = Functions.GetPositionDetails().Symbol;
MMParser parser1 = Data.ParseFormula("a = close < sma(50);");
TimeSeries a = parser1.GetTimeSeries(symbol, "a");
if(a[0] == 1)
{
Functions.UpdateOrder(Orders.CloseMarketOrder());
}



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
Transform any order into a limit order selectively based on a tra...
Money Management System to Split Order Into Smaller Pieces
Analyst Rating (Yahoo Historical Buy/Sell Recommendations)
Percentage of Bars a Trading rule Generates Buy/Sell Signals
Yahoo Historical Buy/Sell Recommendations

How-to Lessons
How to set order type of a trading system programmatically
How to generate buy/sell signals from a trading system
How to quickly add a ticker symbol
How to get trading orders from a portfolio programmatically
How to get stocks for a particular index using the global script

Related Forum Threads
Multiple Sell Order Types in a single system
Order types
Late portfolio buy/sell signals
OnNewPosition and Timestamps and Order ID
Chart Tab order

Blog Posts
Synchronize Buy/Sell List of Rules in the Trading System Optimize...
Different Types of Trading Indicators: Trend, Momentum, Volatilit...
Different periodicities and chart bar types in QuantShare Trading...
4 indicators to create adaptive trading systems
Working with the formula editor









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.