I would like to change a variable using a txt document that will change with a stock. - futures io
futures io



I would like to change a variable using a txt document that will change with a stock.


Discussion in EasyLanguage Programming

Updated
    1. trending_up 2,650 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. 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)

 
Search this Thread
 

I would like to change a variable using a txt document that will change with a stock.

(login for full post details)
  #1 (permalink)
Mgem
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.

Reply With Quote

Can you help answer these questions
from other members on futures io?
in depth understanding of last, bid, and ask volume in c …
NinjaTrader
Multi Time Frame High/Low/Median levels
NinjaTrader
Anyone ever use "Seasonax" website?
Trading Reviews and Vendors
Big Mo Indicator for NT8
NinjaTrader
Demo accounts order fill
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Is anyone actually making money?
52 thanks
An embarrassing, honest confession
37 thanks
Sierra vs. Ninja : why I chose .....
8 thanks
Machine Learning Journal
5 thanks
Institutional Grade Massive Data Dump for Quant Research …
5 thanks
 
(login for full post details)
  #2 (permalink)
 ABCTG   is a Vendor
 
 
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 View Post
I would like to change a variable using a txt document that will change with a stock.


Follow me on Twitter Reply With Quote
 
(login for full post details)
  #3 (permalink)
Mgem
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;

Reply With Quote
 
(login for full post details)
  #4 (permalink)
 ABCTG   is a Vendor
 
 
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 View Post
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;


Follow me on Twitter Reply With Quote
 
(login for full post details)
  #5 (permalink)
Mgem
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

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > I would like to change a variable using a txt document that will change with a stock.


Last Updated on June 30, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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.
no new posts