logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
garykong  
#1 Posted : Wednesday, August 10, 2005 9:12:04 AM(UTC)
garykong

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/30/2005(UTC)
Posts: 112

Hi all, The topic may have discussed before, but I can't find relevant one(s) to prepare for the consitions in an alert that I am working on:- Background: trading timeframe is 5 min the local stock market opens: 9:45 to 12:30 & 14:30 to 16:15 1) One of the conditions to signal a buy: +ve slope of simple moving average of 7 periods in 15-min timeframe 2) Alternatively, one of the conditions to signal a sell: - ve slope of simple moving average of 7 periods in 15-min timeframe 3) Also, one stop loss conditions is that when price closes below the lower Bollinger Band in 1-min timeframe Lastly, will it be different if I change the trading timeframes from 15min (condition to enter) / 5 min (trading) / 1 min (condition to cut loss) to hourly (condition to enter) / 15 min (trading) / 5 min (conition to cut loss)?? I need help to code the above. Gary
StorkBite  
#2 Posted : Wednesday, August 10, 2005 5:06:05 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Hey Gary- I don't know what ve slope is :oops: Do you have a formula for the indicator already? Could it be as simple as... a:= {ve slope} mov(a,7,S); Bollinger band stop Syntax: bbandbot(DATA ARRAY, PERIODS, METHOD, DEVIATIONS) Perhaps something like this will work? C<bbandbot(C,1,S,2); Also, check out the following: http://forum.equis.com/viewtopic.php?t=1072
garykong  
#3 Posted : Thursday, August 11, 2005 12:42:41 AM(UTC)
garykong

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/30/2005(UTC)
Posts: 112

Hi g_stockman, Thanks for your comment. I don't if there is any smarter way to code slope, I use: + ve slope: Mov(C,7,S) > Ref(Mov(C,7,S); -ve slope: Mov(C,7,S) > Ref(Mov(C,7,S); Lower BB: BBandBot(Typical(),20,S,2); BUT I have to code the moving average on 15-min timeframe on a chart of 5-min; and lower BB on 1-min timeframe on a chart of 5-min.... Gary
StorkBite  
#4 Posted : Thursday, August 11, 2005 1:32:36 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Hey Gary- Just a little disclaimer: I'm new to writing my own indicators too. The following are just my thoughts. While I have tried this, I don't know if it's what you are looking for or not. Hopefully, it will spur your own thoughts. :D If you're working from a 5-minute chart, then 15 minutes=3 periods. Using your example with the Typical() function, you could make a crossover-type indicator plotted as a histogram. If it swings positive, your conditions are met, if negative they aren't. I'm not sure about how to configure the BB for 1 minute. That would be 0.2 periods on the 5 minute chart and the formula won't accept that. It will accept 1 period = 5 minutes. Buy:= If(Mov(C,3,S) >= Ref(Mov(C,3,S),-1),1,-1); Sell:= If(C<BBandBot(Typical(),1,S,2),1,-1); Signal:= If(Buy= 1 AND Sell= -1, 1,-1); Signal;0;
StorkBite  
#5 Posted : Thursday, August 11, 2005 1:51:49 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Another thought... Can you use a 1 minute chart and modify your formulas this way? Buy:= If(Mov(C,15,S) >= Ref(Mov(C,15,S),-1),1,-1); Sell:= If(C<BBandBot(Typical(),1,S,2),1,-1); Signal:= If(Buy= 1 AND Sell= -1, 1,-1); Signal;0;
john_hastie  
#6 Posted : Thursday, August 11, 2005 2:09:31 AM(UTC)
john_hastie

Rank:: Member

Groups ready for retrieval: Registered, Registered Users
Joined: 6/8/2005(UTC)
Posts: 17

g_stockman....I apologise in advance if you have already figured this out but I believe that "ve" is an abbreviation... +ve = Positive -ve = Negative So a +ve slope is calculated by calculating y/x for whatever you're looking at.
StorkBite  
#7 Posted : Thursday, August 11, 2005 4:02:38 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Thanks John- Actually, I thought is was something specific. I never did find a reference. Your generic slope formula is easy enough. There are many variations that can be introduced. Perhaps something like this: a:=C; b:=Ref(C,-5); slope:=(a-b)/b; slope;
garykong  
#8 Posted : Monday, August 15, 2005 1:56:29 PM(UTC)
garykong

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/30/2005(UTC)
Posts: 112

Hi g_stockman, Thanks for your suggestion. However, it didn't resolve my needs. Would anyone could suggest how to code the rising / dropping trend of moving average of 7-period in 15-min timeframe, on the platform of 5-min timeframe (i.e. use the moving average signal of 7 period in a higher timeframe, 15-min, while trading on 5-min timeframe)? And how to code the signal when price hits the lower Bollinger Band in 1-min chart, on the platform of 5-min timeframe? Do I need to use "Adaptive Moving Average Function"? I am new to this..... Gary
StorkBite  
#9 Posted : Monday, August 15, 2005 5:01:23 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Hey Gary- I'm not giving up damnit! :D This is a mission now! Try this. The 5 minute and 15 minute results are very, very close, but not exact. {15-minute EMA on 5-minute chart} A1:=ValueWhen(3,C>0,C); A2:=Mov(A1,7,E); A2; {One possible utility} Cross(Mov(C,1,E),A2); As far as the 1 minute band criteria, I can't make logical sense of it. You only have 5 minute data loaded. I don't see how you can examine a higher resolution without the data being available. That being said, you could easily make a template that has the 1 minute data in it along with your 5 minute data. That would work.
StorkBite  
#10 Posted : Saturday, August 27, 2005 5:26:02 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Hi Patrick or others, How can I use Enhanced System Tester to test a higher trading timeframe, say 30 min timeframe, while using 1 min historical data? Thanks... Gary
mstt  
#11 Posted : Sunday, August 28, 2005 12:10:41 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Gary The way I see it, to test 30-minute indicators on 1-minute data with the EST (or any other test tool for that matter) you need indicators specially built for the job. For accuracy you need something after the style of my daily and weekly indicators for use with intraday and EOD data respectively. Examples can be found at http://www.metastocktips.co.nz/other_formulas.html . It's necessary to have a timing mechanism so that data is only sampled at the end of the longer timframe (instead of every bar), and it's also necessary to be able to form the indicator in MFL language (at least for those of us that can't create a dll) so that it can be adapted to the new timing mechanism. For a function such as SAR(), one that can't be recreated in MFL, it's not possible to create the longer timeframe version in MFL either. Some functions, and an EMA is a good example, use PREV when written in MFL code, so it's necessary to use PREV for the longer timeframe version too. The use of PREV imposes overheads that may or may not be aceptable. Just the fact that a lot more variables are required to make the longer timeframe version of a function work can impose unacceptable overheads if you're planning to optimise on a lot of securities. Up to now I've struggled to come up with a timing mechanism for use on intraday charts that I was happy with, but I think I've cracked it. I'm working on a mechanism that will operate on any intraday data and allow the user to select any longer intraday timeframe for their chosen (and specially adapted) indicators. This was to be a project presented in the next MSTT newsletter but I can't quite see it making the September issue. I'll be happy to present practical examples of this work to the forum when I've finished testing. The problem with most indicators designed for this sort of application is that they are simple approximations of the real thing, and some of the time that's simply not good enough. If you want a weekly SMA for daily data that changes value 5 times during the week, then just multply the periods value by 5 and you've got it. However, if you want an indicator that actually gets the values for each week correct, including through public holidays, and holds that value for the full week, then you need something a little more sophisticated than Mov(C,10*5,S) for a 10 week SMA. Then there's considerations like, do you want weekly SMA that uses Friday data on Friday night, or are you happy to accept an SMA that dosn't plot the most recent weekly value until Monday data is available. Or Maybe you want to know the dynamic value of the weekly SMA on Wednesday night, and how can that be achieved? Forgive me for discussing weekly on daily scenarios but that's what I've done the most work on. Longer on shorter intraday is more difficult (IMO) for several reasons. Apart from there being a greater selection of periodicity options, the fact that MS hourly bars end on Minute()=0, rather than begining there, is probably the most troublesome aspect of longer on shorter intraday. As I said earlier, I think I've cracked it, but only time will tell. Is it easy? No. Can it be done? Yes. Will it solve all your problems? Very unlikely. Don't try and recreate the wheel when most of the design work has already been done though. Roy
garykong  
#12 Posted : Sunday, August 28, 2005 12:34:34 AM(UTC)
garykong

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/30/2005(UTC)
Posts: 112

Hay Ray, Thanks for your constructive comments. I didn't think that the multiple timeframes for intraday data is so so troblesome as you said.... and I am suprised that it is not relsoved with the MS language or as least it is not that easy to be done!! suprised! Am I creating trouble or no-one is interested in multiple timeframe system testing? Cos I think that one system may work in one timeframe, may not work in another one. I think it is worth spending research on it as what you are contributing!! One more thing for Patrick, I have seen the demo video, https://www.metastock.co...binar/metastockdemo.aspx I have a preception that one can test higher timeframe, say 30 min, using the EST while using 1-min historical data.... Am I right? or it is a wrong preception only... Cheers! Gary p/s one stupid way to test the multiple timeframe, that I can think of, is to attach the trading system to the timeframe that you like, record the result manually to see if it works on the timeframe that you have selected if no other option can apply.... but it is not efficient!!
mstt  
#13 Posted : Sunday, August 28, 2005 2:02:13 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Gary I'm not the right person to answer your most recent questions. I think 9.1 has a "multiple timeframe template", but that's not going to work with the System Tester. I think you're stuck with using my style of indicator. The new timing mechanism can be made simpler than the ones on my website, but that involves removing all the "bells and whistles. As for your original questions, it should be quite easy to build an indicator that checks the slope of a 7-period, 15-minute periodicity SMA on 1-minute chart or test data. I think I have the necessary code for the timing mechanism (but I won't release it until it's tested properly), and I already have a couple of ways to assemble an SMA (and about 30 other funtions so far) on a working timing signal. Once the SMA is constructed its easy to check whether it's moving up or down. The code for a very similar weekly market conditions indicator appears in one of my newlsetters - it uses daily data to show if two different weekly SMAs are moving up and whether the current price is above both of them. You'll have to be patient for about 3 weeks before you'll see my solution posted here. Too many other demands on my time. Roy
garykong  
#14 Posted : Sunday, August 28, 2005 2:34:19 PM(UTC)
garykong

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/30/2005(UTC)
Posts: 112

Roy, Can you givemeyour website? My e-mail is garykong88@hotmail.com Gary
mstt  
#15 Posted : Sunday, August 28, 2005 7:52:57 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Gary www.metastocktips.co.nz/other_formulas.html will take you to the right page. Roy
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.