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.

derek2209

Convert to Tradestation Easylanguage.

Recommended Posts

Hi,

 

I am new to Tradestation Easylanguage Code

and I do not know when * how to use Arrays.

 

Could you please help me hoe to convert the code below into Tradestation Easylanguage.

 

Hoping you can oblige.

Thank you in advance

 

Derek

 

------------------------------------------------------------

 



/*

Turbo_JRSX : a better RSI ?

Ported from Metatrader.
Original source code : http://codebase.mql4.com/source/6182

*/

SetChartOptions (0, 0, chartGrid20 | chartGrid50 | chartGrid80);

Len = Param ( "Periods", 12, 1, 200, 1 );


function JRSX ( Period )
{

f88 = 0; f90 = 0; f0 = 0; v4 = 0; 	v8 = 0; vC = 0; v10 = 0; v14 = 0; v18 = 0; v20 = 0;
f8 = 0; f10 = 0; f18 = 0; f20 = 0; f28 = 0; f30 = 0; f38 = 0; f48 = 0; v1C = 0;
f50 = 0; f58 = 0; f60 = 0; f68 = 0; f70 = 0; f78 = 0; f80 = 0; f40 = 0;

f90 = 1.0;
f0  = 0.0;

if ( Period-1 >= 5 )
	f88 = Period-1.0;
else
	f88 = 5.0;

f8 = 100.0 * ((H[0]+L[0]+Close[0])/3);
f18 = 3.0 / (Period + 2.0);
f20 = 1.0 - f18;

  for ( i = 1; i < BarCount; i++ )
{
	if (f88 <= f90) f90 = f88 + 1; else f90 = f90 + 1;
	f10 = f8;
//    f8 = 100*Close[i];
	f8 = 100.0*((H[i]+L[i]+C[i])/3);
	v8 = f8 - f10;
	f28 = f20 * f28 + f18 * v8;
	f30 = f18 * f28 + f20 * f30;
	vC = f28 * 1.5 - f30 * 0.5;
	f38 = f20 * f38 + f18 * vC;
	f40 = f18 * f38 + f20 * f40;
	v10 = f38 * 1.5 - f40 * 0.5;
	f48 = f20 * f48 + f18 * v10;
	f50 = f18 * f48 + f20 * f50;
	v14 = f48 * 1.5 - f50 * 0.5;
	f58 = f20 * f58 + f18 * abs (v8);
	f60 = f18 * f58 + f20 * f60;
	v18 = f58 * 1.5 - f60 * 0.5;
	f68 = f20 * f68 + f18 * v18;

	f70 = f18 * f68 + f20 * f70;
	v1C = f68 * 1.5 - f70 * 0.5;
	f78 = f20 * f78 + f18 * v1C;
	f80 = f18 * f78 + f20 * f80;
	v20 = f78 * 1.5 - f80 * 0.5;

	if ((f88 >= f90) && (f8 != f10)) f0 = 1.0;
	if ((f88 == f90) && (f0 == 0.0)) f90 = 0.0;
	if ((f88 < f90) && (v20 > 0.0000000001))
	{
		v4 = (v14 / v20 + 1.0) * 50.0;
		if (v4 > 100.0) v4 = 100.0;
		if (v4 < 0.0) v4 = 0.0;
	}
	else
	{
		v4 = 50.0;
	}

	rsx[i] = v4;
}

return rsx;
}


dynamic_color = IIf( JRSX(Len)>Ref(JRSX(Len),-1), colorBlue, colorRed ); 
Plot( JRSX(Len), "RSX", dynamic_color,styleThick=4 );


Plot(70,"",colorGreen,styleDashed = 32);
Plot(60,"",colorGreen,styleDashed = 32);
Plot(40,"",colorGreen,styleDashed = 32);
Plot(30,"",colorGreen,styleDashed = 32);
Plot(50,"",colorBlue,styleLine = 1);


Title =EncodeColor(colorBlue)+"                      Turbo JRSX " + "      Period = " + WriteVal( Len,1)+"    JRSX  ="+WriteVal(JRSX(Len));


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.