Trading Articles
Article Categories
Article Tools
I would like to change a variable using a txt document that will change with a stock.
Updated June 30, 2022
trending_up
2,650 views
thumb_up
0 thanks given
group
2 followers
forum
4 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
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 and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I would like to change a variable using a txt document that will change with a stock.
(login for full post details)
#1 (permalink )
New York City
Posts: 15 since Apr 2021
Thanks: 2 given,
0
received
I would like to change a variable using a txt document that will change with a stock.
Can you help answer these questions from other members on futures io?
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#2 (permalink )
Posts: 2,363 since Apr 2013
Thanks: 426 given,
1,579
received
Mgem,
can you post the code you have so far? This might help in steering you in the right direction.
Regards,
ABCTG
Mgem
I would like to change a variable using a txt document that will change with a stock.
(login for full post details)
#3 (permalink )
New York City
Posts: 15 since Apr 2021
Thanks: 2 given,
0
received
Yup this is what I have so far
Code
using elsystem;
using elsystem.io;
inputs:
iDateFile( "C:\Users\Michael\Desktop\StatsTime.txt" ),
iInterval( 25 ), // Number of seconds to pause between charts
iEnableCycling( true );
variables:
int Idx( 0 ),
StreamReader SR( null ),
intrabarpersist FirstTime( "" ),
intrabarpersist NextTime( "" ),
Timer Tmr( null );
method void Tmr_Elapsed( elsystem.Object sender, elsystem.TimerElapsedEventArgs args )
begin
RunCommand( NextTime );
end;
method void CreateTimer()
begin
Tmr = Timer.Create();
Tmr.Interval = (1000 * iInterval) astype int;
Tmr.Elapsed += Tmr_Elapsed;
Tmr.AutoReset = false;
Tmr.Start();
end;
once( LastBarOnChartEx )
begin
if GetAppInfo( aiMacroEnabled ) = 0 then
RaiseRuntimeError( "Study requires RunCommand enabled." );
SR = StreamReader.Create( iDateFile );
while SR.EndOfStream = false
begin
if Idx = 0 then
begin
FirstTime = SR.ReadLine();
NextTime = FirstTime;
end
else if Time = StrToNum(NextTime) then
begin
NextTime = SR.ReadLine();
CreateTimer();
break;
end
else
begin
NextTime = SR.ReadLine();
if iEnableCycling and SR.EndOfStream and Time = StrToNum(NextTime) then
begin
NextTime = FirstTime;
CreateTimer();
break;
end;
end;
Idx += 1;
end;
SR.Close();
end;
(login for full post details)
#4 (permalink )
Posts: 2,363 since Apr 2013
Thanks: 426 given,
1,579
received
Mgem,
seeing that you have multiple similar posts in the TS forum regarding this or similar topics it might make sense to concentrate the efforts in one place.
Can you describe in your words what the code does and what it should do instead? Additionally, why did you decide to use Runcommand and a timer for the task at hand?
Regards,
ABCTG
Mgem
Yup this is what I have so far
Code
using elsystem;
using elsystem.io;
inputs:
iDateFile( "C:\Users\Michael\Desktop\StatsTime.txt" ),
iInterval( 25 ), // Number of seconds to pause between charts
iEnableCycling( true );
variables:
int Idx( 0 ),
StreamReader SR( null ),
intrabarpersist FirstTime( "" ),
intrabarpersist NextTime( "" ),
Timer Tmr( null );
method void Tmr_Elapsed( elsystem.Object sender, elsystem.TimerElapsedEventArgs args )
begin
RunCommand( NextTime );
end;
method void CreateTimer()
begin
Tmr = Timer.Create();
Tmr.Interval = (1000 * iInterval) astype int;
Tmr.Elapsed += Tmr_Elapsed;
Tmr.AutoReset = false;
Tmr.Start();
end;
once( LastBarOnChartEx )
begin
if GetAppInfo( aiMacroEnabled ) = 0 then
RaiseRuntimeError( "Study requires RunCommand enabled." );
SR = StreamReader.Create( iDateFile );
while SR.EndOfStream = false
begin
if Idx = 0 then
begin
FirstTime = SR.ReadLine();
NextTime = FirstTime;
end
else if Time = StrToNum(NextTime) then
begin
NextTime = SR.ReadLine();
CreateTimer();
break;
end
else
begin
NextTime = SR.ReadLine();
if iEnableCycling and SR.EndOfStream and Time = StrToNum(NextTime) then
begin
NextTime = FirstTime;
CreateTimer();
break;
end;
end;
Idx += 1;
end;
SR.Close();
end;
(login for full post details)
#5 (permalink )
New York City
Posts: 15 since Apr 2021
Thanks: 2 given,
0
received
For sure. This was something I was sent from John on the TS forum. It originally was meant for cycling through stock symbols and it worked pretty well. the code below was my attempt at getting it to cycle through time rather then symbols. The timer is in there in order to allow the stock to fully load and print the data I needed before moving onto the next one. Right now this code doesnt seem to do anything. What I was attempting to do is have it set as a variable and have it cycle through a list and change with the according date and symbol. If you need me to go into more detail or need to see the current code im using to cycler through the dates and trade just let me know and I can give that to you
Last Updated on June 30, 2022
Ongoing