Click here to Login





                                                   Help with the following trading system

  0

0
suresh
2010-08-30 09:34:22


I want to code the following trading system.

Buy next bar at current low.
After the purchase, sell next bar at limit of high of purchase bar.
If position open for more than 3 bars, sell at market.

So the positions should be held atleast 1 bar, maximum 4 bars.

The current implementation I have closes the position on same day as purchase



QuantShare
2010-08-30 10:50:32

  0

Best Answer
Hi,

Here is the trading system implementation:

Buy next bar at today's low:
Set your buy rule and set the buy limit price to buy at tomorrow "low".

Sell next bar at limit of high of purchase bar:
Set "1" as sell rule and set the sell limit price to sell at tomorrow "high". Because the sell rule is set to 1, it will be executed on the same day the stock was purchased and then will use the high price of the purchase bar.

Set N-Bar Stop to 4 bars.



suresh
2010-08-30 11:08:50

  0

I do not want to sell on the day of purchase. This is the code that was generated. Please tell me how to modify this so that I will not sell on the same day as purchase. PS. I want to avoid the situation, when the high price occurs at the open and the low price happens at close.

BuyPrice(low, 0);
SellPrice(high, 5);

// Buy rules

Rule1 = (1) > (0);
buy = (Rule1);

// Sell rules

Rule2 = (1) > (0);
sell = (Rule2);




QuantShare
2010-08-30 12:05:44

  0

This system does not sell on the same date as the purchase date.
Make sure you use sell at tomorrow order type.

Please verify your trades.



suresh
2010-08-30 12:13:46

  0

OK. It is after 1 day. Now what is Nb Bars. It shows as 0 for trades that are sold the next day. I was ASSuming that it is numbers of bars the trade is held.


QuantShare
2010-08-30 12:25:13

  0

We will fix this. Thanks.


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 to use with the Trading System Optimizer
Design and backtest a trading system with two strategies
Ratio of the Short to Long-Term Moving Averages - ETF Trading Sys...
Short Term Trading System with RSI Ratios
Intraday Trading System with Daily Ranking

How-to Lessons
How to add a metric in the trading system simulation report
How to optimize the stop limit of a trading system
How to optimize the number of positions in a trading system
How to debug a trading system using the money management tool
How to set order type of a trading system programmatically

Related Forum Threads
Ranking System with Trading System Help, Revisited
How to read the number of positions in trading system
Trading system optimization using the QuantShare API Simulator
Add a trading system to the price volume chart
Ranking System Help

Blog Posts
Synchronize Buy/Sell List of Rules in the Trading System Optimize...
Basic trading system implemented using the money management tool
Trading Forex with the commitments of traders report
How to Backtest an Intraday Stock Trading System with EOD Ranking
How to Optimize a Trading System with Thousands of Billions of Co...









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.