Welcome to the Traders Laboratory Forums.
Trading Indicators Post your custom trading indicators. If you download, remember to click INSTALL.

Reply
Januson Function Library Details »»
Januson Function Library
Platform: 1+, by januson januson is offline
Developer Last Online: Aug 2011 Show Printable Version Email this Page

Platform: MultiCharts Rating:
Released: 11-28-2008 Last Update: Never Installs: 0
Supported
Re-useable Code Translations  

This is a collection of small and usefull functions from my library. I'll just post them as I write or review old ones

I'm using MultiCharts, but I'm almost sure that tradestation users can compile them without any problems as both supports EasyLanguage.

************************* **
Function: JK_Math_RoundToNearest
Just a small function from my library. I've discovered that RangeBars can give some funny open and closing values that needs to be comformed correct in order to write a pattern recognizer.


Code:
//FunctionName: JK_Math_RoundToNearest 
//Summary: A small function invented for rounding numbers to nearest precision i.e. round 100.27 to 100.25 or 95.86 to 95.75
//Author: Januson Nov2008, rev.0

//Example: JK_Math_RoundToNearest(100.58, 0.25) -> 100.50

 inputs:
 	valueToRound(NumericSimple),
 	nearestFraction(NumericSimple);
 	
 
begin
 
var:
 	double PRECISION(10000); //constant
 	

 	
 	JK_Math_RoundToNearest = IntPortion(valueToRound) + (round((fracportion(valueToRound)* PRECISION) /(nearestFraction * PRECISION), 0) * (nearestFraction * PRECISION))/PRECISION;
 	
end;
Bump: When I develop indicators I need to have quick and easy access to debug information, i.e. Why is this value that at this point? I therefore insert JK_BarDateTime in the if-then or other points of interest.

Example from indicator:
if condition1 and condition5 then
begin
... yada yada
print(JK_BarDateTime, condition1, valueXX);
end;

I can then use the output window to track debug info quite easily

Code:
//FunctionName: JK_BarDateTime
//Summary: A function to convert the EasyLanguage datetime information from current bar
//Author: Januson Oct2008, rev.0

//Example: Print(JK_BarDateTime);

JK_BarDateTime = DateTimeToString(datetojulian(date) + ELTimeToDateTime_s(Time_s)) ;

Show Your Support

  • If you like to thanks you by the author -> Click Thanks to the Author
  • This modification may not be copied, reproduced or published elsewhere without the author's permission.
The Following User Says Thank You to januson For This Useful Post:
Tams (08-09-2010)

Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can function in TS8 return array? ImXotep Technical Analysis 5 05-25-2009 02:13 AM
"Rebase" function in Tradestation dupaski Brokers and Data Feeds 13 09-20-2008 08:12 PM

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