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

Reply
Old 10-12-2009, 08:17 PM   #1

Join Date: May 2009
Location: lisbon
Posts: 4
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Easy Language Indicator Help

Hi,

iīm trying to create an indicator that exports realtime data to a csv file, i stuck in two points now, first the code :

variables : ask(0),bid(0),result(0);

ask = insideask;
bid = insidebid;
result = (bid + (ask - bid) / 2);

print( file( " ****1 " ), DateFormat( "DDMMYY", "-"), " ", ***2 , ";", result );
plot1(result,"");


****1 - is possible to put here the symbol and current date each time i plot this in a chart ?
****2 - i try to figure out a way to put here HHMMSS but i couldnīt do it

In the result itīs strange because only the first 2 decimal appears, for instance in fx instead of appear 1.4875 only appears 1.48

please can somebody help me in this task, really apprecciated.

regards

Last edited by eggzactly; 10-12-2009 at 08:26 PM.
eggzactly is offline  
Reply With Quote
Old 10-12-2009, 08:42 PM   #2

suriNotes's Avatar

Status: Educational Partner
Join Date: Nov 2007
Location: Seattle, WA
Posts: 165
Ignore this user

Thanks: 8
Thanked 156 Times in 59 Posts

Re: Easy Language Indicator Help

Quote:
Originally Posted by eggzactly »
Hi,

iīm trying to create an indicator that exports realtime data to a csv file, i stuck in two points now, first the code :

variables : ask(0),bid(0),result(0);

ask = insideask;
bid = insidebid;
result = (bid + (ask - bid) / 2);

print( file( " ****1 " ), DateFormat( "DDMMYY", "-"), " ", ***2 , ";", result );
plot1(result,"");


****1 - is possible to put here the symbol and current date each time i plot this in a chart ?
****2 - i try to figure out a way to put here HHMMSS but i couldnīt do it

In the result itīs strange because only the first 2 decimal appears, for instance in fx instead of appear 1.4875 only appears 1.48

please can somebody help me in this task, really apprecciated.

regards

Hi eggzactly,

Look into TS functions like FormatDate, FormatTime for formatting date and time.
There may be other user developed functions for Date and Time on TS Forums.

You can also use Symbol or GetSymbolName to get symbol names.

To print decimals correctly use print(" myValue = ", myValue:1:4) format, 4 is number of decimals.

Regards,
Suri
suriNotes is offline  
Reply With Quote
Old 10-12-2009, 08:54 PM   #3

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: Easy Language Indicator Help

look up these keywords:

Text
NumToStr
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 10-12-2009, 09:59 PM   #4

Join Date: May 2009
Location: lisbon
Posts: 4
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Re: Easy Language Indicator Help

Thanks for quick answer.

Well i resolve the issue of decimal places, thanks.

Abou the time i tried ELTimetoDateTime_s but with no result :-( my problem is getting the time in the format HH:MM:SS .

Regarding the file, i see the text function but unfortunately i donīt know how to code that in the file function, can please help me.

thanks in advance.

regards,
eggzactly
eggzactly is offline  
Reply With Quote
Old 10-12-2009, 10:07 PM   #5

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: Easy Language Indicator Help

at the multicharts menu bar,
select Help> MultiCharts Help

the MultiCharts User Guide will pop out

select the Contents tab

expand the PowerLanguage section

expand the Keyword Reference

you will see a section devoted to Date and Time Routines


Hope the above helps
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 10-12-2009, 10:17 PM   #6

suriNotes's Avatar

Status: Educational Partner
Join Date: Nov 2007
Location: Seattle, WA
Posts: 165
Ignore this user

Thanks: 8
Thanked 156 Times in 59 Posts

Re: Easy Language Indicator Help

Here is the code to print current Bar's Date and Time in "hh:mm:ss tt" format

==============
Var: strVar(""), pDateTime(0);

if (lastBarOnchart) then
begin
pDateTime = DateToJulian( Date ) + ( TimeToMinutes( Time ) / 60 / 24 ) ;
strVar =(FormatTime("hh:mm:ss tt",pDateTime));
print(strvar);
end;
==============

Regards,
Suri



Quote:
Originally Posted by eggzactly »
Thanks for quick answer.

Well i resolve the issue of decimal places, thanks.

Abou the time i tried ELTimetoDateTime_s but with no result :-( my problem is getting the time in the format HH:MM:SS .

Regarding the file, i see the text function but unfortunately i donīt know how to code that in the file function, can please help me.

thanks in advance.

regards,
eggzactly
suriNotes is offline  
Reply With Quote
The Following User Says Thank You to suriNotes For This Useful Post:
eggzactly (10-12-2009)
Old 10-12-2009, 10:43 PM   #7

Join Date: May 2009
Location: lisbon
Posts: 4
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Re: Easy Language Indicator Help

Quote:
Originally Posted by suriNotes »
Here is the code to print current Bar's Date and Time in "hh:mm:ss tt" format

==============
Var: strVar(""), pDateTime(0);

if (lastBarOnchart) then
begin
pDateTime = DateToJulian( Date ) + ( TimeToMinutes( Time ) / 60 / 24 ) ;
strVar =(FormatTime("hh:mm:ss tt",pDateTime));
print(strvar);
end;
==============

Regards,
Suri
Hi,

Sorry for so many questions.

Why seconds always appear like this,and that ticks was not in the same second ?

2009-10-13 03:38:00;1.47720000
2009-10-13 03:38:00;1.47720000
2009-10-13 03:38:00;1.47720000
2009-10-13 03:38:00;1.47720000
2009-10-13 03:38:00;1.47720000
2009-10-13 03:38:00;1.47717500
2009-10-13 03:38:00;1.47717500
2009-10-13 03:38:00;1.47715000

regards,

eggzactly
eggzactly is offline  
Reply With Quote
Old 10-31-2009, 08:38 PM   #8

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: Easy Language Indicator Help

Quote:
Originally Posted by eggzactly »
Hi,

Sorry for so many questions.

Why seconds always appear like this,and that ticks was not in the same second ?

2009-10-13 03:38:00;1.47720000
2009-10-13 03:38:00;1.47720000
2009-10-13 03:38:00;1.47720000
2009-10-13 03:38:00;1.47720000
2009-10-13 03:38:00;1.47720000
2009-10-13 03:38:00;1.47717500
2009-10-13 03:38:00;1.47717500
2009-10-13 03:38:00;1.47715000

regards,

eggzactly



don't understand what you are talking about.
can you illustrate what you want to do ???
__________________



Only an idiot would reply to a stupid post
Tams 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
[Help]Convert MQ4 to Easy Language eggzactly Coding Forum 1 10-11-2009 12:36 PM
Easy Language Help JKLM Automated Trading 7 02-10-2009 11:17 PM
Easy Language - Question ephi144 Coding Forum 1 01-25-2009 10:15 PM
Help with Easy Language BrianA Coding Forum 29 01-13-2009 03:32 PM
Easy Language in OEC, Help with Channel Indicator popstocks Coding Forum 10 11-07-2008 06:09 PM

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