NexusFi: Find Your Edge


Home Menu

 





Easylanguage: Dynamic Text Box


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one eros1973ms with 13 posts (5 thanks)
    2. looks_two Jura with 4 posts (4 thanks)
    3. looks_3 Big Mike with 3 posts (1 thanks)
    4. looks_4 futat with 2 posts (0 thanks)
    1. trending_up 11,873 views
    2. thumb_up 10 thanks given
    3. group 3 followers
    1. forum 21 posts
    2. attach_file 6 attachments




 
Search this Thread

Easylanguage: Dynamic Text Box

(login for full post details)
  #11 (permalink)
eros1973ms
florence
 
Posts: 25 since Oct 2011
Thanks Given: 2
Thanks Received: 6


Jura View Post
Hm, true, TradeStation doesn't have that word (I'm a MultiCharts user). I've just scanned through the TradeStation 8.3 EasyLanguage manual, and using the reserved words that I found there, something like this should work..

 
Code
variables: leftDate(0), leftTime(0), rightDate(0), rightTime(0);

if LastBarOnChart_s = true then begin

    leftDate = JulianToDate(GetAppInfo(aiLeftDispDateTime));
    leftTime = (HoursFromDateTime(GetAppInfo(aiLeftDispDateTime)) * 10000) + 
        (MinutesFromDateTime(GetAppInfo(aiLeftDispDateTime)) * 100) +
        SecondsFromDateTime(GetAppInfo(aiLeftDispDateTime));

    value10 = Text_new_s(leftDate, leftTime, Low - 0.02, "Hello");
    value11 = Text_SetStyle(value10, 0, 2);
    
    rightDate = JulianToDate(GetAppInfo(aiRightDispDateTime));
    rightTime = (HoursFromDateTime(GetAppInfo(aiRightDispDateTime)) * 10000) + 
        (MinutesFromDateTime(GetAppInfo(aiRightDispDateTime)) * 100) +
        SecondsFromDateTime(GetAppInfo(aiRightDispDateTime));
    
    value15 = Text_new_s(rightDate, rightTime, High + 0.02, "GoodBye");
    value16 = Text_SetStyle(value15, 1, 2);
    
end;
Since I don't use TradeStation, I don't know if it would work, but it contains a workaround for not using DateTime2ELTime_s and thus (in theory) should work for TradeStation (it works here on MultiCharts fine).

Good luck.

yeeeeahhhhhhhhhhhhhhhhhh

I had to make some correction, as text_new is expecting the time in this format: hhmm.ss, so the working version for tradestation is:
 
Code
(HoursFromDateTime(GetAppInfo(aiLeftDispDateTime)) * 100) + 
(MinutesFromDateTime(GetAppInfo(aiLeftDispDateTime))) +
SecondsFromDateTime(GetAppInfo(aiLeftDispDateTime));

Reply With Quote
The following user says Thank You to eros1973ms for this post:

Can you help answer these questions
from other members on NexusFi?
ZigZag displaying ticks
Platforms and Indicators
ISO Equity Curve Indicator
NinjaTrader
IQFeed MBO data experience
The Elite Circle
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Request for MACD with option to use different MAs for fa …
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Supertradersams Thread Journal on NQ/MNQ
28 thanks
GFIs1 1 DAX trade per day journal
25 thanks
Diary of a simple price action trader
13 thanks
Deaddogs Stock Trading
12 thanks
Daytrading ES & NQ
11 thanks

(login for full post details)
  #12 (permalink)
eros1973ms
florence
 
Posts: 25 since Oct 2011
Thanks Given: 2
Thanks Received: 6

I continue here... Jura's help has been fantastic!

Now the text is correctly positioned and moved anytime I resize the chart.
One single problem: the first plotted test (the one plotted when I activate the indicator) remains there.
Then when I resize, a new text is plotted in the correct position and moved anytime I resize, but the first plotted text remains there!

PS: also when there is a new bar, the text plotted in the previous bar in not moved but a new text is plotted.

 
Code
vars:
	date_1(0),
	time_1(0),
	price_1(0),
	hours(0),
	minut(0),
	time_2(0),
	txt_id1(-1), txt_id2(-1),
	txt_id3(-1), txt_id4(-1), txt_id5(-1);


date_1 = JulianToDate(GetAppInfo(aiLeftDispDateTime));

time_2 = (HoursFromDateTime(GetAppInfo(aiLeftDispDateTime)) * 100) + 
        (MinutesFromDateTime(GetAppInfo(aiLeftDispDateTime))) +
        SecondsFromDateTime(GetAppInfo(aiLeftDispDateTime));

price_1 = getappinfo(aiHighestDispValue)-0.5*offset_points;


//text creation and first position
		//txt_id1 = text_new(date_1, time_2, price_1, "--------------------------------");
		txt_id2 = text_new(date_1, time_2, price_1-offset_points, "Buy 	Setup       " +numtostr(setup_count_buy,0));
		txt_id3 = text_new(date_1, time_2, price_1-offset_points, "Buy 	Sequential  " +numtostr(count_dwn_buy,0));
		txt_id4 = text_new(date_1, time_2, price_1-offset_points, "Sell Setup       " +numtostr(setup_count_sell,0));
		txt_id5 = text_new(date_1, time_2, price_1-offset_points, "Sell Sequential  " +numtostr(count_dwn_sell,0));
//text position		
//value1=text_setlocation(txt_id1, date_1, time_2, price_1); //riga
value2=text_setlocation(txt_id2, date_1, time_2, price_1-offset_points); //buysetup counter
value3=text_setlocation(txt_id3, date_1, time_2, price_1-1.5*offset_points); //buysetup status
value4=text_setlocation(txt_id4, date_1, time_2, price_1-2*offset_points);
value5=text_setlocation(txt_id5, date_1, time_2, price_1-2.5*offset_points);

Attached Thumbnails
Click image for larger version

Name:	example.jpg
Views:	303
Size:	190.0 KB
ID:	53231  
Reply With Quote
(login for full post details)
  #13 (permalink)
eros1973ms
florence
 
Posts: 25 since Oct 2011
Thanks Given: 2
Thanks Received: 6


ok, I solved!

Just put the text_new function inside a routine conditioned by currentbar=1:

 
Code
if currentbar=1 then
		begin
		//txt_id1 = text_new(date_1, time_2, price_1, "---" +text(setup_buy));
		txt_id2 = text_new(date_1, time_2, price_1-offset_points, "Buy 	Setup       " +numtostr(setup_count_buy,0));
		txt_id3 = text_new(date_1, time_2, price_1-offset_points, "Buy 	Sequential  " +numtostr(count_dwn_buy,0));
		txt_id4 = text_new(date_1, time_2, price_1-offset_points, "Sell Setup       " +numtostr(setup_count_sell,0));
		txt_id5 = text_new(date_1, time_2, price_1-offset_points, "Sell Sequential  " +numtostr(count_dwn_sell,0));
		end;

Reply With Quote
The following user says Thank You to eros1973ms for this post:
(login for full post details)
  #14 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Posts: 50,232 since Jun 2009
Thanks Given: 33,103
Thanks Received: 101,344


eros1973ms View Post
ok, I solved!

Just put the text_new function inside a routine conditioned by currentbar=1:

Real quick glance, I think you can do all this using the reserve word "once":

once cleardebug;
once txt_id2 = text_new(date_1, time_2, price_1-offset_points, "Buy Setup " +numtostr(setup_count_buy,0));

and etc.

But same diff.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor


For the best trading education, watch our webinars
Searching for trading reviews? Review this list


Lifetime Elite Membership: Sign-up for only $149 USD
Receive exclusive offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
(login for full post details)
  #15 (permalink)
eros1973ms
florence
 
Posts: 25 since Oct 2011
Thanks Given: 2
Thanks Received: 6


Big Mike View Post
Real quick glance, I think you can do all this using the reserve word "once":

once cleardebug;
once txt_id2 = text_new(date_1, time_2, price_1-offset_points, "Buy Setup " +numtostr(setup_count_buy,0));

and etc.

But same diff.

Mike

Thanks Mike.

But both with my version and your version, the box positioning work ok, but I dont know why, the variable dispays wrong values, as confirmed by the print command on the same variables (this does not happen without the "once" command or the check for the currentbar=1).
Actual piece of code:
 
Code
vars:
	date_1(0),
	time_1(0),
	price_1(0),
	hours(0),
	minut(0),
	time_2(0),
	txt_id1(-1), txt_id2(-1),
	txt_id3(-1), txt_id4(-1), txt_id5(-1);


date_1 = JulianToDate(GetAppInfo(aiLeftDispDateTime));

time_2 = (HoursFromDateTime(GetAppInfo(aiLeftDispDateTime)) * 100) + 
        (MinutesFromDateTime(GetAppInfo(aiLeftDispDateTime))) +
        SecondsFromDateTime(GetAppInfo(aiLeftDispDateTime));

price_1 = getappinfo(aiHighestDispValue)-0.5*offset_points;


//text creation and first position
		//txt_id1 = text_new(date_1, time_2, price_1, "--------------------------------");
                once cleardebug;
		once txt_id2 = text_new(date_1, time_2, price_1-offset_points, "Buy 	Setup       " +numtostr(setup_count_buy,0));
		once txt_id3 = text_new(date_1, time_2, price_1-offset_points, "Buy 	Sequential  " +numtostr(count_dwn_buy,0));
		once txt_id4 = text_new(date_1, time_2, price_1-offset_points, "Sell Setup       " +numtostr(setup_count_sell,0));
		once txt_id5 = text_new(date_1, time_2, price_1-offset_points, "Sell Sequential  " +numtostr(count_dwn_sell,0));
//text position		

value2=text_setlocation(txt_id2, date_1, time_2, price_1-offset_points); //buysetup counter
value3=text_setlocation(txt_id3, date_1, time_2, price_1-1.5*offset_points); //buysetup status
value4=text_setlocation(txt_id4, date_1, time_2, price_1-2*offset_points);
value5=text_setlocation(txt_id5, date_1, time_2, price_1-2.5*offset_points);


if symbol = "GS:EUR A0-FX" then 
	print(
	date, "  ",
	time, "  ",
	"Setup count Buy", "  ",
	setup_count_buy, "  ",
	"Sequential Buy", "  ",
	count_dwn_buy, "  ",
	"Setup count Sell", "  ",
	setup_count_sell, "  ",
	"Sequential Sell", "  ",
	count_dwn_sell
	);

Attached Thumbnails
Click image for larger version

Name:	error.jpg
Views:	278
Size:	325.3 KB
ID:	53322  
Reply With Quote
(login for full post details)
  #16 (permalink)
eros1973ms
florence
 
Posts: 25 since Oct 2011
Thanks Given: 2
Thanks Received: 6



solved!!!

sure, the once command allowed for the txt creation only once !! I had to re-evaluate the string.
Final code:

 
Code
vars:
	date_1(0),
	time_1(0),
	price_1(0),
	hours(0),
	minut(0),
	time_2(0),
	txt_id1(-1), txt_id2(-1),
	txt_id3(-1), txt_id4(-1), txt_id5(-1);


date_1 = JulianToDate(GetAppInfo(aiLeftDispDateTime));

time_2 = (HoursFromDateTime(GetAppInfo(aiLeftDispDateTime)) * 100) + 
        (MinutesFromDateTime(GetAppInfo(aiLeftDispDateTime))) +
        SecondsFromDateTime(GetAppInfo(aiLeftDispDateTime));

price_1 = getappinfo(aiHighestDispValue)-0.5*offset_points;


//text creation and first position
		//txt_id1 = text_new(date_1, time_2, price_1, "--------------------------------");
once cleardebug;
		once txt_id2 = text_new(date_1, time_2, price_1-offset_points, "Buy 	Setup       " +numtostr(setup_count_buy,0));
		once txt_id3 = text_new(date_1, time_2, price_1-offset_points, "Buy 	Sequential  " +numtostr(count_dwn_buy,0));
		once txt_id4 = text_new(date_1, time_2, price_1-offset_points, "Sell Setup       " +numtostr(setup_count_sell,0));
		once txt_id5 = text_new(date_1, time_2, price_1-offset_points, "Sell Sequential  " +numtostr(count_dwn_sell,0));
//text position		
//value1=text_setlocation(txt_id1, date_1, time_2, price_1); //riga

value10= text_setstring(txt_id2, "Buy 	Setup       " +numtostr(setup_count_buy,0));
value2=text_setlocation(txt_id2, date_1, time_2, price_1-offset_points); //buysetup counter

value11= text_setstring(txt_id3, "Buy 	Sequential  " +numtostr(count_dwn_buy,0));
value3=text_setlocation(txt_id3, date_1, time_2, price_1-1.5*offset_points); //buysetup status

value12= text_setstring(txt_id4, "Sell Setup       " +numtostr(setup_count_sell,0));
value4=text_setlocation(txt_id4, date_1, time_2, price_1-2*offset_points);

value13= text_setstring(txt_id5, "Sell Sequential  " +numtostr(count_dwn_sell,0));
value5=text_setlocation(txt_id5, date_1, time_2, price_1-2.5*offset_points);


if symbol = "GS:EUR A0-FX" then 
	print(
	date, "  ",
	time, "  ",
	"Setup count Buy", "  ",
	setup_count_buy, "  ",
	"Sequential Buy", "  ",
	count_dwn_buy, "  ",
	"Setup count Sell", "  ",
	setup_count_sell, "  ",
	"Sequential Sell", "  ",
	count_dwn_sell
	);

Reply With Quote
The following user says Thank You to eros1973ms for this post:
(login for full post details)
  #17 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Posts: 50,232 since Jun 2009
Thanks Given: 33,103
Thanks Received: 101,344


eros1973ms View Post


solved!!!

sure, the once command allowed for the txt creation only once !! I had to re-evaluate the string.
Final code:

Yes sorry, I did not look very close at your code

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor


For the best trading education, watch our webinars
Searching for trading reviews? Review this list


Lifetime Elite Membership: Sign-up for only $149 USD
Receive exclusive offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
(login for full post details)
  #18 (permalink)
eros1973ms
florence
 
Posts: 25 since Oct 2011
Thanks Given: 2
Thanks Received: 6


Big Mike View Post
Yes sorry, I did not look very close at your code

Mike


why sorry? thanks for your help!

Reply With Quote
The following user says Thank You to eros1973ms for this post:
(login for full post details)
  #19 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Posts: 50,232 since Jun 2009
Thanks Given: 33,103
Thanks Received: 101,344


eros1973ms View Post
why sorry? thanks for your help!

LOL, cuz I gave you bad advice



Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor


For the best trading education, watch our webinars
Searching for trading reviews? Review this list


Lifetime Elite Membership: Sign-up for only $149 USD
Receive exclusive offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
(login for full post details)
  #20 (permalink)
futat
Hong Kong
 
Posts: 6 since Nov 2011
Thanks Given: 1
Thanks Received: 1


Hello, Eros1973ms & Big Mike

Much thanks for your code.
Could you tell me more hint that how the text correctly positioned and moved anytime when resize the chart?
Does it is related the below vars for coding this effect?

time_1(0),
price_1(0),
hours(0),
minut(0),

Reply With Quote





Last Updated on May 9, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts