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

Notification

Icon
Error

Options
Go to last post Go to first unread
regsinha  
#1 Posted : Wednesday, November 30, 2005 11:18:53 AM(UTC)
regsinha

Rank: Member

Groups: Registered, Registered Users
Joined: 11/4/2005(UTC)
Posts: 10
Location: Sydney, Australia

Hi, Can anybody please point as to how I may get information/code for a custom indicator for TSI which appreared in S&C June edition. Thanks in advance.
Jose  
#2 Posted : Wednesday, November 30, 2005 3:09:18 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Try this TSI code. Description: "True Strength Index, fully adjustable & with multiple output choice". jose '-)
regsinha  
#3 Posted : Thursday, December 1, 2005 11:51:26 AM(UTC)
regsinha

Rank: Member

Groups: Registered, Registered Users
Joined: 11/4/2005(UTC)
Posts: 10
Location: Sydney, Australia

Thank you Jose. I am new to Metastock and I plotted the indicator as per your instructions. I have also read the articles in the S&C magazine and Thom Hartley's and the diagrams I see in these articles are different to what I have plotted using your formula. Would appreciate if you can provide some commentary as to how to use your indicators for entry and exit points. Many thanks. Reg
Jose  
#4 Posted : Thursday, December 1, 2005 2:47:01 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Reg, the oscillator will make more sense when plotted on its own window. Here's an updated version: [code:1:d086fb88c4] MetaStock -> Tools -> Indicator Builder -> New Copy and paste formula below. =================== True Strength Index =================== ---8<--------------------------- { True Strength Index (TSI) v2.0 ©Copyright 2003~2005 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } pdsRoc:=Input("ROC periods",1,252,3); pdsEma:=Input("EMA periods",1,252,5); smooth:=Input("smoothing EMA periods",1,252,21); { TSI } TSI:=100* Mov(Mov(ROC(C,pdsRoc,%),pdsEma,E),smooth,E)/ Mov(Mov(Abs(ROC(C,pdsRoc,%)),pdsEma,E),smooth,E); avg:=Cum(TSI)/Cum(IsDefined(TSI)); { Auto over-Bought/Sold levels } pk:=Ref(TSI,-1)=HHV(TSI,3) AND TSI>0; pkVal:=ValueWhen(1,pk,Ref(TSI,-1)); Obought:=Cum(pkVal*pk)/Cum(pk); tr:=Ref(TSI,-1)=LLV(TSI,3) AND TSI<0; trVal:=ValueWhen(1,tr,Ref(TSI,-1)); Osold:=Cum(trVal*tr)/Cum(tr); { Plot in own window } Obought;avg;Osold;TSI ---8<--------------------------- [/code:1:d086fb88c4] Basing complete entry & exit signals on one single indicator is never a good idea, but I would eyeball a few charts and look for meaningful TSI/price patterns that may be compatible with my own trading style. Any promising finds could then be added as additional entry/exit signals to my own existing trading strategy. Experiment with different ROC/EMA period combinations. Look for increasing/decreasing strength (higher TSI troughs, lower TSI peaks). Look for divergences between TSI and price. jose '-)
regsinha  
#5 Posted : Thursday, December 1, 2005 7:42:40 PM(UTC)
regsinha

Rank: Member

Groups: Registered, Registered Users
Joined: 11/4/2005(UTC)
Posts: 10
Location: Sydney, Australia

Jose, Please accept my sincere thanks for your willingness to share such precious information. I will look forward to following your suggestions. Reg Sinha
regsinha  
#6 Posted : Thursday, January 12, 2006 12:54:27 PM(UTC)
regsinha

Rank: Member

Groups: Registered, Registered Users
Joined: 11/4/2005(UTC)
Posts: 10
Location: Sydney, Australia

Hello Jose and Compliments of the season to you, I took the Christmas break to review your Indicators and attach the plot as below: However, I cannot make out where the crossovers are occurring in order for me to determine the entry and exit points. Looking at Thom Hartle's article, the TSI is plotted somewhat differently from your formulae and I was hoping whether you are able to shed some light how to correlate your plot back to Thom's plot as below?
Jose  
#7 Posted : Thursday, January 12, 2006 2:52:12 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
For a simple TSI-zero crossover, try this basic indicator: [code:1:a3e44a8d22] TSI:=Fml("True Strength Index"); entry:=Cross(TSI,0); exit:=Cross(0,TSI); entry-exit [/code:1:a3e44a8d22] Oscillator/zero crossovers often signal too late, after all the price action has gone. I would try something like this instead: [code:1:a3e44a8d22] { Reference "True Strength Index" indicator } TSI:=Fml("True Strength Index"); oBought:=FmlVar("True Strength Index","OBOUGHT"); oSold:=FmlVar("True Strength Index","OSOLD"); avg:=FmlVar("True Strength Index","AVG"); { TSI signals } entry:=Cross(TSI,oSold); exit:=Ref(TSI>oBought,-1) AND TSI<Ref(TSI,-1) OR Cross(avg,TSI) OR Cross(oSold,TSI); { Clean signals } init:=Cum(IsDefined(entry+exit))=1; bin:=ValueWhen(1,entry-exit<>0 OR init,entry); long:=bin*(Alert(bin=0,2) OR init); short:=(bin=0)*(Alert(bin,2) OR init); signals:=long-short; { Plot in own window } signals [/code:1:a3e44a8d22] It takes a lot more than signals from a single indicator to make a reasonably good trading system. jose '-)
pumrysh  
#8 Posted : Thursday, January 12, 2006 3:26:54 PM(UTC)
pumrysh

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/28/2004(UTC)
Posts: 110

regsinha, I checked S&C and could not find the article. Are you sure that was the source. Reason that I ask is because Hartle left S&C and went to Active Trader several years ago. Checking Active Trader I found the following: January 2002 For "True Strength Index (TSI)" by Thom Hartle, starting on p. 58: TSI(close,r,s) = 100*EMA(EMA(mtm,r),s)/EMA(EMA(|mtm|,r),s) where mtm = closetoday - closeyesterday EMA(mtm,r) = exponential moving average of mtm with alpha = r EMA(EMA(mtm,r),s) = exponential moving average of EMA(mtm,r) with alpha = s |mtm| = absolute value of mtm r = 25, s = 13 ** For MetaStock, use the Indicator Builder: 100*(Mov(Mov((CLOSE - Ref(CLOSE,-1)),25,E),13,E))/(Mov(Mov(Abs(CLOSE - Ref(CLOSE,-1)),25,E),13,E)) Hope this helps, Preston
regsinha  
#9 Posted : Thursday, January 12, 2006 8:57:00 PM(UTC)
regsinha

Rank: Member

Groups: Registered, Registered Users
Joined: 11/4/2005(UTC)
Posts: 10
Location: Sydney, Australia

Dear Jose and Preston Thank you both for your invaluable inputs and I will spend this morning checking it out. Jose, you are absolutely correct in saying that more than one indicator is necessary for a good trading system and once I get the TSI right, I will try to find other confirming indicators to complement the TSI. If you have any ideas, I would welcome your thoughts. Preston, you are spot on with Thom's article as it was in the Active Trader magazine that I copied and pasted the diagram onto this post. Thanking you both sincerely again. Reg
regsinha  
#10 Posted : Thursday, January 12, 2006 11:39:05 PM(UTC)
regsinha

Rank: Member

Groups: Registered, Registered Users
Joined: 11/4/2005(UTC)
Posts: 10
Location: Sydney, Australia

Hi Jose, I must be missing another step in copying and pasting your formulae into the Indicator Builder as I got the following error message. Would appreciate your feedback, please? Thanks. Reg
Jose  
#11 Posted : Friday, January 13, 2006 11:29:13 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Reg, you've failed to copy & paste the complete TSI code between the "---8<----" lines. Copy & paste the complete TSI code first, and then copy & paste the TSI signals indicator. jose '-)
regsinha  
#12 Posted : Friday, January 13, 2006 2:38:18 PM(UTC)
regsinha

Rank: Member

Groups: Registered, Registered Users
Joined: 11/4/2005(UTC)
Posts: 10
Location: Sydney, Australia

Hello Jose, Sorry to be a pain but I was confused with the last set of codes which you sent. I was under the impression that these were stand alone formulas and I have now copied and pasted the additional code to the orginal formula. Please review and validate as to whether I have done the right thing as I am still very new to Metastock programming and am trying to learn as much from the manuals. I am very much indebted to you and many others who have responded with your patience and charity in terms of time and technical expertise to us, newbies. Thanks once again, Reg =========================================================================== { True Strength Index (TSI) v2.0 } ©Copyright 2003~2005 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } pdsRoc:=Input("ROC periods",1,252,3); pdsEma:=Input("EMA periods",1,252,5); smooth:=Input("smoothing EMA periods",1,252,21); { TSI } TSI:=100* Mov(Mov(ROC(C,pdsRoc,%),pdsEma,E),smooth,E)/ Mov(Mov(Abs(ROC(C,pdsRoc,%)),pdsEma,E),smooth,E); avg:=Cum(TSI)/Cum(IsDefined(TSI)); { Auto over-Bought/Sold levels } pk:=Ref(TSI,-1)=HHV(TSI,3) AND TSI>0; pkVal:=ValueWhen(1,pk,Ref(TSI,-1)); Obought:=Cum(pkVal*pk)/Cum(pk); tr:=Ref(TSI,-1)=LLV(TSI,3) AND TSI<0; trVal:=ValueWhen(1,tr,Ref(TSI,-1)); Osold:=Cum(trVal*tr)/Cum(tr); { Plot in own window } Obought;avg;Osold;TSI { Reference "True Strength Index" indicator } TSI:=Fml("True Strength Index"); oBought:=FmlVar("True Strength Index","OBOUGHT"); oSold:=FmlVar("True Strength Index","OSOLD"); avg:=FmlVar("True Strength Index","AVG"); { TSI signals } entry:=Cross(TSI,oSold); exit:=Ref(TSI>oBought,-1) AND TSI<Ref(TSI,-1) OR Cross(avg,TSI) OR Cross(oSold,TSI); { Clean signals } init:=Cum(IsDefined(entry+exit))=1; bin:=ValueWhen(1,entry-exit<>0 OR init,entry); long:=bin*(Alert(bin=0,2) OR init); short:=(bin=0)*(Alert(bin,2) OR init); signals:=long-short; { Plot in own window } signals ====================================================== [color=red:97b023b58b][/color][size=9:97b023b58b][/size:97b023b58b]
Jose  
#13 Posted : Friday, January 13, 2006 11:47:12 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Reg, if the indicator plots in MetaStock, then you've followed the correct procedure. jose '-)
regsinha  
#14 Posted : Saturday, January 14, 2006 2:44:26 PM(UTC)
regsinha

Rank: Member

Groups: Registered, Registered Users
Joined: 11/4/2005(UTC)
Posts: 10
Location: Sydney, Australia

Hi Jose, Unfortunately the cut and paste of both the formulae as indicated below did not plot as it has errors which my very limited Metastock knowledge is unable to resolve. [code:1:4fd324329a]{ True Strength Index (TSI) v2.0 ©Copyright 2003~2005 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } pdsRoc:=Input("ROC periods",1,252,3); pdsEma:=Input("EMA periods",1,252,5); smooth:=Input("smoothing EMA periods",1,252,21); { TSI } TSI:=100* Mov(Mov(ROC(C,pdsRoc,%),pdsEma,E),smooth,E)/ Mov(Mov(Abs(ROC(C,pdsRoc,%)),pdsEma,E),smooth,E); avg:=Cum(TSI)/Cum(IsDefined(TSI)); { Auto over-Bought/Sold levels } pk:=Ref(TSI,-1)=HHV(TSI,3) AND TSI>0; pkVal:=ValueWhen(1,pk,Ref(TSI,-1)); Obought:=Cum(pkVal*pk)/Cum(pk); tr:=Ref(TSI,-1)=LLV(TSI,3) AND TSI<0; trVal:=ValueWhen(1,tr,Ref(TSI,-1)); Osold:=Cum(trVal*tr)/Cum(tr); { Plot in own window } Obought;avg;Osold;TSI { Reference "True Strength Index" indicator } TSI:=Fml("True Strength Index"); oBought:=FmlVar("True Strength Index","OBOUGHT"); oSold:=FmlVar("True Strength Index","OSOLD"); avg:=FmlVar("True Strength Index","AVG"); { TSI signals } entry:=Cross(TSI,oSold); exit:=Ref(TSI>oBought,-1) AND TSI<Ref(TSI,-1) OR Cross(avg,TSI) OR Cross(oSold,TSI); { Clean signals } init:=Cum(IsDefined(entry+exit))=1; bin:=ValueWhen(1,entry-exit<>0 OR init,entry); long:=bin*(Alert(bin=0,2) OR init); short:=(bin=0)*(Alert(bin,2) OR init); signals:=long-short; { Plot in own window } signals [/code:1:4fd324329a] Can you please assist again? Many thanks, Reg SinhaUserPostedImage
Jose  
#15 Posted : Saturday, January 14, 2006 4:21:20 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Reg, you've managed to combine the code from two separate indicators into one, you devilish hacker, you... :) Remove the following lines of code: [code:1:0b3b9d773b]{ Plot in own window } Obought;avg;Osold;TSI { Reference "True Strength Index" indicator } TSI:=Fml("True Strength Index"); [/code:1:0b3b9d773b] and your combined indicator will work fine. jose '-)
regsinha  
#16 Posted : Saturday, January 14, 2006 10:37:18 PM(UTC)
regsinha

Rank: Member

Groups: Registered, Registered Users
Joined: 11/4/2005(UTC)
Posts: 10
Location: Sydney, Australia

Hi Jose, Thank you for again looking into this issue which I think promises to be a good indicator combined with some other confirming signals. Unfortunately, after faithfully following your instructions and combined with my total lack of know how, I received this error message. Can you please help me why I still managed to stuff up as to what seems a very straight forward solution by your :oops: Thanks.
Jose  
#17 Posted : Saturday, January 14, 2006 11:43:12 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Reg, try the MS code below (copy & paste complete indicator code): [code:1:022b29fe99] { True Strength Index (TSI) signals v2.0 ©Copyright 2003~2005 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } pdsRoc:=Input("ROC periods",1,252,3); pdsEma:=Input("EMA periods",1,252,5); smooth:=Input("smoothing EMA periods",1,252,21); { TSI } TSI:=100* Mov(Mov(ROC(C,pdsRoc,%),pdsEma,E),smooth,E)/ Mov(Mov(Abs(ROC(C,pdsRoc,%)),pdsEma,E),smooth,E); avg:=Cum(TSI)/Cum(IsDefined(TSI)); { Auto over-Bought/Sold levels } pk:=Ref(TSI,-1)=HHV(TSI,3) AND TSI>0; pkVal:=ValueWhen(1,pk,Ref(TSI,-1)); Obought:=Cum(pkVal*pk)/Cum(pk); tr:=Ref(TSI,-1)=LLV(TSI,3) AND TSI<0; trVal:=ValueWhen(1,tr,Ref(TSI,-1)); Osold:=Cum(trVal*tr)/Cum(tr); { TSI signals } entry:=Cross(TSI,oSold); exit:=Ref(TSI>oBought,-1) AND TSI<Ref(TSI,-1) OR Cross(avg,TSI) OR Cross(oSold,TSI); { Clean signals } init:=Cum(IsDefined(entry+exit))=1; bin:=ValueWhen(1,entry-exit<>0 OR init,entry); long:=bin*(Alert(bin=0,2) OR init); short:=(bin=0)*(Alert(bin,2) OR init); signals:=long-short; { Plot in own window } signals [/code:1:022b29fe99] jose '-)
regsinha  
#18 Posted : Sunday, January 15, 2006 11:45:35 AM(UTC)
regsinha

Rank: Member

Groups: Registered, Registered Users
Joined: 11/4/2005(UTC)
Posts: 10
Location: Sydney, Australia

Jose, Thanking you very much for your perseverance and generosity with your time and patience. :D It now works, and the next challenge is to find other confirming signals and learn how to code in Metastock. Reg
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.