Click here to Login

                                                   Buy Today,Sell Tomorrow


2020-08-03 02:37:23


I need to design BTST system.

Buy today at Close.
Sell tomorrow, If High is Higher Than BuyPrice * 1.02 OR at Close (i.e Close of Next day of Buy)
Further I need only one position each day having 100 Shares only.

Here how to code BuyPrice & SellPrice. ( Please Without wizard) and How to code Position Size.


2020-08-03 18:03:17



My answers below.

buy = 1;

Buy today at Close.
SetSimTiming(_Buy, _Close, -1);

Sell tomorrow, If High is Higher Than BuyPrice * 1.02 OR at Close (i.e Close of Next day of Buy)
SetSimStop(_StopProfit, _Percent, 2, 0);
SetSimStop(_StopNBar, _Point, 0, 0);
SetSimTiming(_Sell, _Close, -1);

Further I need only one position each day having 100 Shares only.
SetSimPosSize(100, _Shares);

Also, select "Settings" in the "Create a trading system" form, click on "Capital" then enable "Activate stop immediately".

2020-08-04 01:46:32


Hi Quantshare,

Thanks for reply.
Above code Working almost OK except one point.

I have portfolio of 50 ticker. I need Buy Position for only one Symbol among this portfolio.

That is to say If I Use rule for Buy Qualifying. "rule1 = cross(MacdSignal(20), ema(50));"
And out of 50 symbol say five symbol is qualified for Buy. I want only one symbol for Buy among this five qualified symbol.


2020-08-05 08:45:10



Eagerly Waiting for reply.


2020-08-06 07:40:16



After Googling, I found answer for above query. Update Trading Strategy -> Strategy -> Number of Positions -> 1.

This Solve my purpose but leads to another question.

How QS decide, This one ticker is finally qualifying out of 5 symbol. (Please read my post dated 2020-08-04 above)


2020-08-06 16:29:55


Sorry about the delay.

You can use the "SetSimLongRank" function and QS will use it to decide with ticker to pick if several ones meet your criteria.

No more messages


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"


Trading Items
LSS Pivotal Buy and Sell Numbers - Trend Reaction
Buy Sell Simulation Indicator
buy sell
Buy low, Sell High
Buy Low Sell High Screen

How-to Lessons
How to create a strategy-based portfolio
How to generate buy/sell signals from a trading system
How to perform a basic quantitative analysis using the S&P 500
How to set order type of a trading system programmatically
How to create a screen

Related Forum Threads
Buy and Sell rules combination in Optimizer.
Regarding Ploting Buy Sell Signals
Continues Buy / Sell
Stop orders execute today vs tomorrow - potential peek-ahead?
Plot Up/Down Arrows corresponding to buy and sell signals

Blog Posts
How to get buy and sell orders for a portfolio based on a trading...
How to create buy and sell trading rules based on News Data
Trading System: Moving average crossover and few others buy and s...
Buy the best/top rated stocks or how to create powerful rank base...
Trading System: Buy Stocks based on their Sharpe Ratio Rank

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2023
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
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.