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.

eggzactly

Easy Language Indicator Help

Recommended Posts

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

Edited by eggzactly

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

 

 

 

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 ???

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.