Click here to Login





                                                   Dynamic crossOver point using HhvLlv

  0

0
Kiran
2015-07-02 09:27:53


In the code below, I'm having trouble coding a dynamic crossOver point that's 8 ticks below the current close
- i.e. I'm looking for a bullish pattern where close crossed over 8 ticks below the current close at "some bar in the past" and stayed didn't dip 6 ticks below that crossover point since then.

//strategy code
dynCross= close-8*TickSize();
rule0 = cross(close,dynCross); //i think the code fails here, as it's always comparing current close to dyncross, not the close at "some bar in the past"

rule1 = hhvllv(1, close, BarsSince(rule0))> brickLow-6*TickSize(); // Close stayed above 6 ticks below the last dynamic crossover point.

PlotArrow(rule0, "dynCross", AboveHigh, colorGreen);
buy = rule1;

How do i specify "close at some bar in the past" in rule0? I can't use ref(close,N) expects a specific number, not "some bar in the past"



QuantShare
2015-07-02 11:28:21

  0

You are using the following formula:
rule0 = cross(close,dynCross);

Which is equivalent to:
rule0 = cross(close,close-8*TickSize());

As you can see the second parameter is always below the first one so a crossover never happens.

Also, I am not sure you said can't use ref(close, N).
You can also use: ValueWhen function.

a = Valuewhen(condition, valueToGet, 0);



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
Highest and Lowest value over a dynamic period
Percentage of Stocks Trading Above their Pivot Point
Pivot Point Breakout Scanner
VIDYA - Variable Index Dynamic Average
Multiple Time Frames Trading System - Price / Moving Average Cros...

How-to Lessons
How to create a volatility-based Stop - Dynamic stop based on the...
How to plot a stock using different periods in the same chart
How to calculate the average of a time series using the money man...
How to debug a trading system using the money management tool
How to get stocks for a particular index using the global script

Related Forum Threads
Dynamic Symbol Using CompareAssets()
Dynamic Watchlist update for each time step during a simulation?
Regarding crossover function in case of realtime QS
Dynamic List filter showing strange behavior
Point and Figure charting error

Blog Posts
Dynamic Position Sizing in your Trading System
Backtesting chart patterns using the auto support and resistance ...
How to predict and trade the stock market using pivot points
Trading System: Moving average crossover and few others buy and s...
Download Trading Data using the URL-Script









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.