Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Easylanguage: Dynamic Text Box
Updated May 9, 2012
Top Posters
looks_one
eros1973ms
with 13 posts (5 thanks)
looks_two
Jura
with 4 posts (4 thanks)
looks_3
Big Mike
with 3 posts (1 thanks)
looks_4
futat
with 2 posts (0 thanks)
trending_up
12,479 views
thumb_up
10 thanks given
group
3 followers
forum
21 posts
attach_file
6 attachments
Easylanguage: Dynamic Text Box
October 26th, 2011, 12:18 PM
florence
Posts: 27 since Oct 2011
Thanks Given: 3
Thanks Received: 6
Jura
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));
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
October 26th, 2011, 01:28 PM
florence
Posts: 27 since Oct 2011
Thanks Given: 3
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);
October 26th, 2011, 04:44 PM
florence
Posts: 27 since Oct 2011
Thanks Given: 3
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;
October 26th, 2011, 05:08 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,499 since Jun 2009
Thanks Given: 33,264
Thanks Received: 101,715
eros1973ms
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
October 27th, 2011, 04:33 AM
florence
Posts: 27 since Oct 2011
Thanks Given: 3
Thanks Received: 6
Big Mike
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
);
October 27th, 2011, 07:16 AM
florence
Posts: 27 since Oct 2011
Thanks Given: 3
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
);
October 27th, 2011, 02:15 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,499 since Jun 2009
Thanks Given: 33,264
Thanks Received: 101,715
eros1973ms
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
October 28th, 2011, 03:03 AM
florence
Posts: 27 since Oct 2011
Thanks Given: 3
Thanks Received: 6
Big Mike
Yes sorry, I did not look very close at your code
Mike
why sorry? thanks for your help!
October 31st, 2011, 04:51 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,499 since Jun 2009
Thanks Given: 33,264
Thanks Received: 101,715
May 9th, 2012, 03:13 AM
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),
Last Updated on May 9, 2012