Click here to Login

                                                   How to implement Sell Condition "N-Bar Stop AND Rank>50"?


2019-03-12 11:45:53

I want to write a Sell Condition as Sell = "5-Bar Stop" AND Rank1>50 [Basically evaluate the rank after 5 days of holding the position and then sell]
How do i write "5-Bar Stop" in code? [Didn't find it in documentation or knowledge base]

2019-03-13 03:44:27


For the 5-bar stop, you can either use the money management tool (advanced) or simply use the N-Bar stop in the simulator.

You can implement this in the QS language but you need to be aware that QS formulas are used to generate signals and thus at the execution time, QuantShare does not when a stock was bought or sold.

You could try something like:
sell = barssince(buy) >= 5;

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
How far are the close prices from the support line
Number of Consecutive Trading Bars Condition was True
Return Since a Specific Condition Occurred
buy sell

How-to Lessons
How to generate buy/sell signals from a trading system
How to filter stocks in a market composite
How to draw an horizontal segment line using QS language
How to perform a basic quantitative analysis using the S&P 500
How to hide stock data outside of regular trading hours

Related Forum Threads
how to add buy condition when the color change
Multiple Sell Order Types in a single system
How do I use external dll?
How to determine if the a given day is a trading day?
How to import reconstructed global sovereign bonds

Blog Posts
How to create buy and sell trading rules based on News Data
How to get buy and sell orders for a portfolio based on a trading...
How To Create and Backtest an S&P 500 Trend Following System
How to use QuantShare screener to trade penny stocks
How to create a trading system, screen and composite using earnin...

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

Copyright 2024
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.