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

Reply
Old 09-09-2010, 05:02 PM   #1

Join Date: May 2008
Location: amsterdam
Posts: 114
Ignore this user

Thanks: 25
Thanked 39 Times in 30 Posts

Rounding Print-statement to Full Number

I am aware there allready is an active tread about rounding numbers but it is not working for me,
i am facing somewhat the same problem when printing a to a TXT-file, this solution rounding to
price does not work for me as am im trying to round time or any number not correlated to price in a text file

i am trying to make tradestation to manipulate the price of a certain underlying and print the full numbers incl Hour and Minute in a text file so they can later be imported as 3d party ascii data without needing to do some workaround with open office


example...
Code:
Variables: myvalue(0);

myvalue = mavalue + 1;

Print(File("c:\TradeStationDataExport\TS_Data.txt"), myvalue);
the text file will allways be filled with 2 decimals behind the number myvalue

Output in TXT File:

1.00
2.00
3.00

Needet:

1
2
3

i have tried pretty much all rounding functions (and ofcourse the simple Round reserved word) i could get my hands on and i made up some myself, unfortunally this seems not to work while printing data to an TXT-file.

Thoughts ?
flyingdutchmen is offline  
Reply With Quote
Old 09-09-2010, 08:45 PM   #2

Tams's Avatar

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

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Rounding Print-statement to Full Number

you don't need rounding.

you need to cut off the decimals.

and you need to convert the number to string.


NUMTOSTR
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
The Following User Says Thank You to Tams For This Useful Post:
flyingdutchmen (09-10-2010)
Old 09-10-2010, 12:35 AM   #3

Join Date: Jul 2010
Posts: 60
Ignore this user

Thanks: 13
Thanked 15 Times in 13 Posts

Re: Rounding Print-statement to Full Number

Hi,
TAMS is correct,
Try this,

Print( Numtostr(MyValue,0) );

EasyTrader_I.
EasyTrader_I is offline  
Reply With Quote
Old 09-10-2010, 07:24 AM   #4

Join Date: May 2008
Location: amsterdam
Posts: 114
Ignore this user

Thanks: 25
Thanked 39 Times in 30 Posts

Re: Rounding Print-statement to Full Number

Exactly what i needet Tams,
Thank you
flyingdutchmen is offline  
Reply With Quote
Old 09-10-2010, 11:24 AM   #5

Join Date: May 2008
Location: amsterdam
Posts: 114
Ignore this user

Thanks: 25
Thanked 39 Times in 30 Posts

Re: Rounding Print-statement to Full Number

Outcome:
Constant RangeBars for TradeStation, Been done before ?
flyingdutchmen is offline  
Reply With Quote
Old 09-10-2010, 12:43 PM   #6

Tams's Avatar

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

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Rounding Print-statement to Full Number

Quote:
Originally Posted by flyingdutchmen »
Outcome:
Constant RangeBars for TradeStation, Been done before ?
i don't understand what you are trying to demonstrate.
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 09-10-2010, 01:24 PM   #7

Join Date: May 2008
Location: amsterdam
Posts: 114
Ignore this user

Thanks: 25
Thanked 39 Times in 30 Posts

Re: Rounding Print-statement to Full Number

well, by being able to export the data in a format which can be imported by TS without further modifications, i am able to plot constant range bars from tick-data, at least for the visual part.
from here i would be able to use further calculations onto those range bars like finding swing high's/low's which wasnt possible in TS, at least not standard. timebased swing highs and low do not have the same quality. this is just a workaround. It filters out alot of noise and give me more quality swings. i did not like the MC rangebars so i made my own in TS which do fit my conditions
flyingdutchmen is offline  
Reply With Quote

Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pesavento Pattern Tams Trading Indicators 20 05-03-2010 09:00 AM
Print (EasyLanguage) Tams Coding Forum 8 10-22-2009 01:20 PM

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