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

Reply
Old 08-19-2009, 03:22 PM   #1

Join Date: Jun 2009
Location: ca
Posts: 42
Ignore this user

Thanks: 0
Thanked 2 Times in 2 Posts



TS Indicator for RS - Gaps

Hi

I tried to create a new indicator for RS. Actually i tried to modify an old indicator

I dont know what is the problem....

Any help will be welcomed

Thanks




[SameTickOpt=True];
// Noam Gap Size
//
// Data1 must be intraday -- Data2 not required






Input:
AvgLength ( 20),// length to determine Daily Range Average

Range_Length(20);

Var: Avgvalue ( 0 ),
YH ( 0 ),
YL ( 0 ),
TH ( 0 ),
TL ( 0 ),
{Hsum ( 0 ),
Lsum ( 0 ), }
Yrange ( 0 ),
Trange ( 0 ),
TotalRange ( 0 ),


{ StartPoint ( 0 ),
EndPoint ( 0 ),
sdate ( 0 ),
edate ( 0 ),
YHL ( 0 ),
YLL ( 0 ),
THL ( 0 ),
TLL ( 0 ),
TopenL (0),
YcloseL (0),}
GapPercent (0),
Gap (0),
GappercentGeneral (0),
TYclose (0),
TTopen (0),
Decp ( 0 ),
DIFER (0),
Yclose (0),
Topen (0),
vRange(0),
GapPercentLength (0),
LastBar (false);



YH = HighD(1);
YL = LowD(1);
TH = HighD(0);
TL = LowD(0);
Yclose= closed(1);
Topen= openD (0);




// this section to calculate the Average without requiring Daily Symbol as Data2
TotalRange = 0;
For Value1 = 0 to avglength-1 begin
TotalRange = TotalRange+(HighD(value1)-LowD(value1));
end;
If AvgLength <> 0 then Avgvalue = TotalRange/AvgLength;
// ****

Trange = TH-TL;
Yrange = YH-YL;
difer= Avgvalue-Trange;
Gappercent= (Topen-Yclose)/(yh-yl)*100 ;
gap=topen-yclose;
Gappercent= (Topen-Yclose)/(yh-yl)*100 ;
GappercentGeneral=(Topen-Yclose)/last*100 ;
vRange = Average((High-Low),Range_Length);
GapPercentLength= (Topen-Yclose)/(Avgvalue)*100;

plot1(Gappercent, "Gappercent");
plot2 (Avgvalue, "Avgvalue");
plot3 (difer, "difer");
plot4 (Gap, "gap");






{Text_setstring(Text_ID1, numtostr(Avgvalue,decimal ) +" :Avg_Rg_ "+numtostr(AvgLength, 0)
+" "
+numtostr(TRange,decimal) +" :T_Rg " );
Value1 = TextLocale(Text_ID1,place mentholder,Avg_Color, percent);

Text_setstring(Text_ID4,n umtostr(DIFER,decimal)+" ifer");

Value1 = TextLocale(Text_ID4,place mentholder,DIFER_Color, percent*spreadfactor*.6);

Text_setstring(Text_ID5,n umtostr(GapPercentLength, decimal)+" :G "+numtostr(Range_Length,0 ) + " R %"
+" "
+numtostr(Gap,decimal)+" :G_Sz");



Value1 = TextLocale(Text_ID5,place mentholder,TodayColor, percent*spreadfactor*1); }
N57H is offline  
Reply With Quote
Old 08-19-2009, 03:47 PM   #2

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

Thanks: 62
Thanked 294 Times in 177 Posts



Re: TS Indicator for RS - Gaps

Quote:
Originally Posted by N57H »
Hi

I tried to create a new indicator for RS. Actually i tried to modify an old indicator

I dont know what is the problem....

Any help will be welcomed

Thanks
If you want someone to help you, at least do some effort to explain what the indicator is supposed to do and what error you are getting. Or do you expect that someone has to go through the code to figure out what you think it should do and then let you know what is wrong?
sevensa is offline  
Reply With Quote
Old 08-19-2009, 03:51 PM   #3

Join Date: Jun 2009
Location: ca
Posts: 42
Ignore this user

Thanks: 0
Thanked 2 Times in 2 Posts



Re: TS Indicator for RS - Gaps

Sure,

This indicator should calculate today's gap, the gap as a % of the last x days range and the difference between today range and the average range for the last x days.

I had this indicator as text on the chart. But i tried to modify it to RS without success.

The problem is that this indicator is verified but the RS says that it tried to divide by zero...
N57H is offline  
Reply With Quote
Old 08-19-2009, 03:54 PM   #4

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

Thanks: 62
Thanked 294 Times in 177 Posts



Re: TS Indicator for RS - Gaps

Quote:
Originally Posted by N57H »
Sure,

This indicator should calculate today's gap, the gap as a % of the last x days range and the difference between today range and the average range for the last x days.

I had this indicator as text on the chart. But i tried to modify it to RS without success.

The problem is that this indicator is verified but the RS says that it tried to divide by zero...
Look at all the parts in the code where you use division and see which value can potentially be 0 and then correct this.
sevensa is offline  
Reply With Quote
Old 08-19-2009, 04:01 PM   #5

Tams's Avatar

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

Thanks: 2,027
Thanked 1,402 Times in 862 Posts



Re: TS Indicator for RS - Gaps

Quote:
Originally Posted by N57H »
Sure,

This indicator should calculate today's gap, the gap as a % of the last x days range and the difference between today range and the average range for the last x days.

I had this indicator as text on the chart. But i tried to modify it to RS without success.

The problem is that this indicator is verified but the RS says that it tried to divide by zero...

the least you can do is post a chart, or a mock up.

...and explain the efforts (codes) you have attempted.



(not that I can be of any help...)
Tams is online now  
Reply With Quote
Old 08-19-2009, 04:04 PM   #6

Tams's Avatar

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

Thanks: 2,027
Thanked 1,402 Times in 862 Posts



Re: TS Indicator for RS - Gaps

RS must have the most cumbersome charting language of all.

Take a look at the examples in Stocks & Commodities magazine,
RS codes are 4 times as long as others.
Tams is online now  
Reply With Quote

Reply

Tags
gap

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gaps Test N57H Technical Analysis 0 07-22-2009 11:57 PM
Gaps in Value area waveslider Market Profile 3 07-25-2007 06:20 PM
Trading GAPS Robert Technical Analysis 0 10-05-2006 06:30 PM
Understanding Gaps: Why do they exist? Soultrader Technical Analysis 3 09-23-2006 10:31 PM
Gaps also act as pivots Soultrader Technical Analysis 0 08-10-2006 11:00 AM

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