Click here to Login





                                                   How to specify a "within n-bars" condition?

  0

0
pvu2017
2018-01-01 00:47:11


For example I want to have the following rules...

rule1 = cross(close,sma(20));
rule2 = close > ref(close,1);

buy = rule1 <within 3-bars> AND rule2;

Question: are conditionals in QS for "within 3-bars"?

Thanks,
P.V.



QuantShare
2018-01-01 05:39:46

  0

Best Answer
You can use the highest value over a specific period.
Example:
hhv(rule1, 3) == 1
or just
hhv(rule1, 3)


Returns true if rule1 is TRUE in one of the previous past three bars.



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
How far are the close prices from the support line
Portfolio vs Stock Return
Investing in stocks using the Kelly criterion money management st...
Analyst Rating
Analyst Days Since Last Rating

How-to Lessons
How to draw distances on a chart?
How to plot the relative performance of several stocks/indices
How to plot the number of stock tweets per day
How to generate buy/sell signals from a trading system
How to dynamically update the settings of an indicator

Related Forum Threads
How do I Import Tick Data from a CVS file
How to import Bid, Ask and Trade ticks from CSV file?
how to use AI?
How do you retrieve the entry and exit price for a position?
how to draw Flag (Bullish) on chart?

Blog Posts
How to search for a download item
How to Scan for Parallel Resistance and Support Lines
How to Optimize a Trading System with Thousands of Billions of Co...
How to Automatically Import Local Data Into QuantShare
How to build and backtest a robust stock trading system









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.