Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

N57H

TS Indicator for RS - Gaps

Recommended Posts

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,placementholder,Avg_Color, percent);

 

Text_setstring(Text_ID4,numtostr(DIFER,decimal)+" :Difer");

 

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

 

Text_setstring(Text_ID5,numtostr(GapPercentLength,decimal)+" :G "+numtostr(Range_Length,0) + " R %"

+" "

+numtostr(Gap,decimal)+" :G_Sz");

 

 

 

Value1 = TextLocale(Text_ID5,placementholder,TodayColor, percent*spreadfactor*1); }

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.