RExample 0

Posted on 20, January 2016

in Category SID


Description for RExample SID 985

A simple R example on how to interact between the R and Seer enviroment.

RExample/sid Notes for this Trading Account:

RExample/sid Rules for this Trading Account:

RExample/sid Notes for this Trading System:

RExample/sid Rules for this Trading System:

RExample/sid Begin event logic:

$magicArray = ();	# define magicArray to be an array


RExample/sid Bar event logic:

RVar(Close);

R '

	magicNumber <- mean(Close);		# mean() is our "magic" function

';

my $m = RVar('magicNumber');
Output($m);	#output the indicator value we calculated

push @$magicArray, $m;	# add the value to an array

#output the array as proof that we are adding it correctly to the array
foreach my $tmp (@$magicArray) {	
	Output("   $tmp");
}

#NB: make sure you keep memory usage under check...if the array exceeds the allowed size then truncate it!!!
# in this case we assume that we want to keep barsback/10 qty of values in our array
if(scalar(@$magicArray) > (BarsBack/10)) {
	shift @$magicArray;
}

# output the size of the indicator array to make sure the aray isn't growing out of control
Output(scalar(@$magicArray));

0 Comments

Leave a Message