Click here to Login





                                                   Building an indicator in smaller timeframe to use in larger timeframe

  0

0
Kiran
2015-06-29 09:17:13


I'm trying to build a custom Volume indicator that is aggregated from 1-minute timeframes and used in a 10-minute timeframe strategy. I'm using the following code to (1) Plot on a 10-minute chart (2) use as a condition in my strategy

- I couldn't figure out how to align the 1min plot and 10min plot in the Chart window vertically in order to visually compare the two plots and confirm the formula is correct - To draw the 1min plot, i'm simply deleting the TimeframeCompress command (hope that's correct)
- Appreciate if you could confirm that the code in (1) and (2) below is correct? (Hope i'm not missing a ref(1) offset or something else.


///// 1) To plot on chart
TimeframeSet(60);
dirVol = iff(close>open && (close-open)>0.35*(high-low),volume,iff(close<open && (open-close)>0.35*(high-low),-volume,0));
avgVol = avg(dirVol,10);
dirVol = TimeframeCompress(dirVol);
avgVol = TimeframeCompress(avgVol);
TimeframeRestore();

plot(dirVol, "dir Volume", colorred, ChartBar, stylesymbolnone);
plot(avgVol, "avg Volume", colorblue, ChartLine, stylesymbolnone);

///// 2) Use in the strategy
VolumeInd = TimeframeCompress(TimeframeApply(60,avg(iff(close>open && (close-open)>0.35*(high-low),volume,iff(close<open && (open-close)>0.35*(high-low),-volume,0)),10);

buy = <Buy condition> && VolumeInd >0;
sell = <Sell condition>



QuantShare
2015-06-29 19:26:09

  0

You cannot create indicators based on a smaller time frame using the QS language.
The only way to this is by creating a custom function (Tools -> Create Functions)

You need to extract each component (close, open) then perform your calculation using C#
VectorCustomDouble c = cFunctions.GetTimeframeData(60, "close");



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
Multi TimeFrame RSI
Swing Trading Indicator (STI)
Mass Index Indicator
Large Block Ratio Indicator
Total Power Indicator

How-to Lessons
How to hide a trading indicator from a particular time frame
How to dynamically update the settings of an indicator
How to optimize an indicator in your trading system
How to add a trading indicator to a chart
How to create a custom trading indicator

Related Forum Threads
Indicator based on another symbol in another timeframe
Timeframe Script
Print daily equity with monthly timeframe
No. of bars in a different timeframe
timeframe open Bar

Blog Posts
How to create a trading indicator that uses stock news
10 masks to create thousands of rules to use into your trading sy...
Create a stock index or a trading indicator using the composite t...
How to Select the Best Market Indicator for your Trading System
Backtesting chart patterns using the auto support and resistance ...









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.