NexusFi: Find Your Edge


Home Menu

 





global variable


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one ABCTG with 5 posts (4 thanks)
    2. looks_two ShahramTor with 3 posts (0 thanks)
    3. looks_3 Chuck6475 with 3 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 5,174 views
    2. thumb_up 4 thanks given
    3. group 4 followers
    1. forum 12 posts
    2. attach_file 0 attachments




 
Search this Thread

global variable

  #1 (permalink)
 Chuck6475 
Long Beach
 
Experience: None
Platform: tradestation
Trading: ES
Posts: 11 since Dec 2015
Thanks Given: 3
Thanks Received: 0

Global variables and TradeStation 9.5

I came across Eric Brown's post on Excel & Easy Language and used his template with some changes makes some daily constants ( about 100) available to an indicator I built.

It works great but each time I change the time interval it rereads the data from Excel and does its thing.

I was thinking about figuring out a way to read the data once, as it doesn't change in a day, to Global variable and then doing my thing from there. Is it worth the effort?

I'm not an Easy Language programmer but I can figure it out. I doubt anyone would be impressed by my code but it works.

I downloaded the Global Variable 2.2 stuff and have begun reading it. More Greek than English currently therefore the question, is it worth the effort?

Thanks in advance for your assistance.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Futures True Range Report
The Elite Circle
Are there any eval firms that allow you to sink to your …
Traders Hideout
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
GFIs1 1 DAX trade per day journal
22 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
The Program
20 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


Chuck6475,

I am not sure how to answer if something is worth the effort without knowing what you'd gain by changing it or lose by leaving it the way it is.
So for now I'd say learning something new is most likely worth the effort, as it should develop your skill in EasyLanguage and might be helpful for you later.

On a separate matter it sounds like there are much simpler solutions to your problem than utilizing Global Variables. Why not just block the reload of the Excel data every time you switch the time frame?

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
 Chuck6475 
Long Beach
 
Experience: None
Platform: tradestation
Trading: ES
Posts: 11 since Dec 2015
Thanks Given: 3
Thanks Received: 0


ABCTG View Post
Chuck6475,
.......
On a separate matter it sounds like there are much simpler solutions to your problem than utilizing Global Variables. Why not just block the reload of the Excel data every time you switch the time frame?

Regards,

ABCTG

I'm sure by my question you could tell that I'm a beginner at this, and I really appreciate you taking the time to reply to my question. Conceptually I totally agree, but I don't seem to understand enough about the structure of Easy Language to do it.

-- I put the reading of Excel data in a "ONCE...begin...end" statement, thinking it would only do it once. That didn't work the way I wanted. It appears to do it "ONCE" each time it is invoked (which does make sense) but did cause it to reread the Excel data each time the time interval was changed.

"Blocking the reload" was exactly what I wanted but didn't get. My assumption was that the variable data didn't persist and needed to regenerated each time, therefore I'd have to use Global variable to keep the data once I had loaded it.

It sounds like there is another way, that would be great. Can you point me in that direction? Thanks again.

Started this thread Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

Chuck6475,

you are correct that the variables won't persist upon a symbol/time frame change and once would be re-executed with a change, too.
One idea would be to store a flag within a AppStorage dictionary as these will keep the values upon switching the time frame. So you could set the flag to true when the code is executed the first time and on every new reload check the value of the flag and block reading from Excel.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #6 (permalink)
ShahramTor
Onsala Sweden
 
Posts: 28 since Nov 2016
Thanks Given: 22
Thanks Received: 1

Hello!

Isn't there any way to create any global variable directly in easylanguage without using the dll GlobalVariabel?
Is there any way to run a script once when a MC starts (not associated to any specific chart or scanner)?

Best regards
Shahram

Reply With Quote
  #7 (permalink)
 Chuck6475 
Long Beach
 
Experience: None
Platform: tradestation
Trading: ES
Posts: 11 since Dec 2015
Thanks Given: 3
Thanks Received: 0

The easiest way to do global variables in TS Easy language that I found was using Global Dictionary. I haven't done it for awhile, so I won't try and explain it here. However it isn't that hard. No DLL needed.

Started this thread Reply With Quote
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

ShahramTor,

there is no such option in legacy Easylanguage and Object Oriented EasyLanguage (which is what the solution @Chuck6475 pointed out uses) is not available in Multicharts.

It will take some programming, but you could save a flag status on your hard disk or in memory when "when a MC starts" and runs your indicator. Then have this indicator (or other indicators) read the file/value from memory.

Regards,

ABCTG


ShahramTor View Post
Hello!

Isn't there any way to create any global variable directly in easylanguage without using the dll GlobalVariabel?
Is there any way to run a script once when a MC starts (not associated to any specific chart or scanner)?

Best regards
Shahram


Follow me on Twitter Reply With Quote
Thanked by:
  #9 (permalink)
ShahramTor
Onsala Sweden
 
Posts: 28 since Nov 2016
Thanks Given: 22
Thanks Received: 1

Hello and thanks for your answer,
I would like that MC run a script to login to a specific broker in Sweden, get session-id and save it into a variable which can be read from all other scripts in MC without using any extra DLL-files.
It seems that I would stop searching isn't it?

Regards


Sent from my iPad using futures.io

Reply With Quote
  #10 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


ShahramTor,

I am not aware of a way to accomplish that in regular Multicharts without a DLL. This would be doable in Multicharts.NET.

Regards,

ABCTG


ShahramTor View Post
Hello and thanks for your answer,
I would like that MC run a script to login to a specific broker in Sweden, get session-id and save it into a variable which can be read from all other scripts in MC without using any extra DLL-files.
It seems that I would stop searching isn't it?

Regards


Sent from my iPad using futures.io


Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on December 25, 2021


© 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