Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Like Tree1Likes

Reply
Old 02-18-2009, 07:46 AM   #1

Join Date: Jul 2008
Location: Valdosta, GA
Posts: 48
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Triangle Pattern Indicator Code Not Working

Hey. Have tried this older Triangle Pattern Code I found on the net for tradestation, but apparently the code has changed, and it doesn't recognize the word triangle. Can anyone help? Thanks.

Here's the code, indicator's at the bottom, function at the top:

Triangle Pattern Indicator by Walt Downs

Origin: omega-list
Written by: Walt Downs
Date found: 1 dec 97

Indicator calculates triangles based on SwingHighs and lows of a 10 day range, and with a swing strength of "1". Larger
triangles can be calculated by increasing the strength and/or HighestBar/LowestBar range settings. The indicator plots
a simple "spike" graph, alerting the trader to the presence of a triangle. The trader can then apply logical trendlines to establish break-out points.



Type : Function, Name : Triangle Pattern Indicator

input:
OccurH1(numericsimple),Oc curH2(numericsimple),Occu rL1(numericsimple),
OccurL2(numericsimple),Pr iceH1(numericseries),Pric eH2(numericseries),
PriceL1(numericseries),Pr iceL2(numericseries),Stre nH(numericsimple),
StrenL(numericsimple),Len (numericsimple);

value1 = SwingHighBar(OccurH1,Pric eH1,StrenH,Len);
value2 = SwingHighBar(OccurH2,Pric eH2,StrenH,Len);
value3 = SwingLowBar(OccurL1,Price L1,StrenL,Len);
value4 = SwingLowBar(OccurL2,Price L2,StrenL,Len);


Condition1 = high of value2 bars ago > high of value1 bars ago;
Condition2 = low of value4 bars ago < low of value3 bars ago;
Condition3 = HighestBar(H,Len) = value2;
Condition4 = LowestBar(low,Len) = value4;

if
Condition1 and
Condition2 and
Condition3 and
Condition4
then Triangle = true
else Triangle = false;





Type : Indicator, Name : Triangle Pattern Indicator

input:
OccurH1(1),
OccurH2(2),
OccurL1(1),
OccurL2(2),
PriceH1(high),
PriceH2(high),
PriceL1(low),
PriceL2(low),
StrenH(1),
StrenL(1),
Len(10);

if
Triangle(OccurH1,OccurH2, OccurL1,OccurL2,PriceH1,
PriceH2,PriceL1,PriceL2,S trenH,StrenL,Len)
= true then plot1(10,"TriFinder")
else plot1(0,"TriFinder");

if
Triangle(OccurH1,OccurH2, OccurL1,OccurL2,PriceH1,P riceH2,
PriceL1,PriceL2,StrenH,St renL,Len)
= true then Alert = true;
clbradley is offline  
Reply With Quote
Old 02-18-2009, 09:10 AM   #2

Join Date: Nov 2006
Location: N/A
Posts: 612
Ignore this user

Thanks: 62
Thanked 294 Times in 177 Posts

Re: Triangle Pattern Indicator Code Not Working

The name of the function needs to be "Triangle" when you create it.
sevensa is offline  
Reply With Quote
Old 02-18-2009, 02:52 PM   #3

Join Date: Jul 2008
Location: Valdosta, GA
Posts: 48
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Re: Triangle Pattern Indicator Code Not Working

I made the function Triangle as you noted, yet keep getting an error message that says "Arithmetic (numeric) expression expected here". It is alluding to the word "true" in the 2nd to last sentence, "then Triangle = true"

It will probably say the same thing for false once I fix true. What Arithmetic (numeric) expression should I use instead of true or false near the end of the function code?
Thanks.

Curtis
clbradley is offline  
Reply With Quote
Old 02-18-2009, 03:08 PM   #4

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Triangle Pattern Indicator Code Not Working

The function Triangle returns a True or False condition.

When you set up the new function, TS would ask you for the return type.

Select TrueFalse.
Tams is offline  
Reply With Quote
Old 02-18-2009, 06:17 PM   #5

Join Date: Jul 2008
Location: Valdosta, GA
Posts: 48
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Re: Triangle Pattern Indicator Code Not Working

I am trying to verify, and if there were no errors (this box says Grammar error), then it says verification successful and no problem. This grammar error it blacks out the word "true" (and I tried replacing it with "TrueFalse" and get the same Grammor error message) and within the Grammar error box it says "Arithmetic (numeric) expression expected here. Underneath that you click a little box that says OK, and it just leaves you to figure out what to put instead of the blacked over true or TrueFalse, because they don't work. Have the 2nd to most recent platform, see one just came out within the last week, have tradestation 8.4 (Build 1693). Try it if you're not sure, but it won't verify for me with true or TrueFalse there near the end after "then Triangle =". It seems to want a # I'm guessing by the "Arithmetic (numeric) expression expected here" message. Thanks for any help.

Curtis
clbradley is offline  
Reply With Quote
Old 02-18-2009, 06:48 PM   #6

Join Date: Nov 2006
Location: N/A
Posts: 612
Ignore this user

Thanks: 62
Thanked 294 Times in 177 Posts

Re: Triangle Pattern Indicator Code Not Working

Quote:
Originally Posted by clbradley »
I am trying to verify, and if there were no errors (this box says Grammar error), then it says verification successful and no problem. This grammar error it blacks out the word "true" (and I tried replacing it with "TrueFalse" and get the same Grammor error message) and within the Grammar error box it says "Arithmetic (numeric) expression expected here. Underneath that you click a little box that says OK, and it just leaves you to figure out what to put instead of the blacked over true or TrueFalse, because they don't work. Have the 2nd to most recent platform, see one just came out within the last week, have tradestation 8.4 (Build 1693). Try it if you're not sure, but it won't verify for me with true or TrueFalse there near the end after "then Triangle =". It seems to want a # I'm guessing by the "Arithmetic (numeric) expression expected here" message. Thanks for any help.

Curtis
To be honest, I have no idea what you are saying above, but attached is the code for the function and the indicator in .els format. I only have tradestation 2000 but I guess TS 8.4 would be able to import .els files. Both compiled and I was able to apply the indicator to a chart, but I did not check if it shows anything meaningful.
Attached Files
File Type: zip TRIANGLE.zip (2.0 KB, 47 views)
sevensa is offline  
Reply With Quote
Old 02-19-2009, 07:51 AM   #7

Join Date: Jul 2008
Location: Valdosta, GA
Posts: 48
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Re: Triangle Pattern Indicator Code Not Working

Thanks for trying to help Tams and sevensa, but uploaded the function and indicator from your ELS, tried to use it, and get a TS box that says "study not verified". So I opened the indicator and tried to verify, and it said "Error found in function", and blacked over the word Triangle. So they must have changed what Easy Language (that's a laugh) is recognized between your platform and the more recent ones. Thanks again.

Curtis
clbradley is offline  
Reply With Quote
Old 02-19-2009, 08:21 AM   #8

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Triangle Pattern Indicator Code Not Working

Quote:
Originally Posted by clbradley »
Thanks for trying to help Tams and sevensa, but uploaded the function and indicator from your ELS, tried to use it, and get a TS box that says "study not verified". So I opened the indicator and tried to verify, and it said "Error found in function", and blacked over the word Triangle. So they must have changed what Easy Language (that's a laugh) is recognized between your platform and the more recent ones. Thanks again.
Curtis
1. every time you import, you must verify the codes before they can be used.
(another term for verify is "compile").

2. please first delete the "Triangle" function from your computer. The function needs to be set to TrueFalse. This will be done automatically when you import from ELS.

I have imported the above codes to MultiCharts and they compile with no problem.
Tams is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triangle patterns raven4ns Technical Analysis 3 08-25-2009 10:54 PM
Looking to Enhance Current *working* Trading Methodology Susana E-mini Futures Trading Laboratory 36 01-05-2009 11:58 AM
NZD/USD Symmetrical Triangle DannyBly Forex Trading Laboratory 0 07-07-2008 03:14 PM
Something that's been working TinGull Trading Psychology 9 03-06-2007 04:49 AM

All times are GMT -4. The time now is 12:34 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.