Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Common variable between an indicator and a strategy?
Collapse
X
-
it started out because i was confused at the beginning by unexpected print message [my messages] popping up. i thought maybe for some reason messages were not displayed in the order they were created but rather grouped together by indicator or strategy or whatever. i was flying in the dark. the quick and dirty counter tracking counter would help me help me to understand how the flow actually goes. more generally, i have pursued this only because a 'global' variable can be useful and i got the impression early on in this thread that it could easily be done. I've learned a lot in this dialogue, but at greater time expense than i am comfortable with. i not in this to learn programming, but what is, is. i have rambled on, hope it came out in English.
-
Use the wizard to create a dummy test indicator with one variable of the type that you want to track, then open the indicator for editing and see how the variable that you defined has a private access backing store in the Variables region, and how the public access is exposed in the Properties region. Use the arrangement as an example.Originally posted by joemiller View PostRe: "expose the variable as public in the indicator. This must be done using the Properties of the variable.
all I know is "public int tracectr;"
how does one alternatively do it using "properties"?
Comment
-
my strategy now has the two statements
public int GlobalVariable;
Add(lanceV3(1000));
I think I properly created the indicator as instructed per the preceding post
but now doing a 'LanceV3().GlobalVariable++;' in the strategy
results in error msg 'The name LanceV3 does not exist in the current context'
what am I doing wrong?
Comment
-
Off the bat, C# is CaSe SeNsItIvE. lanceV3 is NOT the same as LanceV3.Originally posted by joemiller View Postmy strategy now has the two statements
public int GlobalVariable;
Add(lanceV3(1000));
I think I properly created the indicator as instructed per the preceding post
but now doing a 'LanceV3().GlobalVariable++;' in the strategy
results in error msg 'The name LanceV3 does not exist in the current context'
what am I doing wrong?
Other than that there is a paucity of information on what exactly you are doing. Yes, I have read your descriptions: I am saying that just a little snippet is often not enough to tell why an error exists.
Also, while I understand that you may have no desire to learn programming, if you are going to write NinjaScript, there is really no alternative. It is just not possible to teach programming using a few snippets of highly specific scenarios: one must needs understand concepts. At this time, it would appear that you may need to bite the bullet and learn the basic concepts first. The NinjaTrader Help file is a good resource, and so is Google.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
88 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
48 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
30 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
34 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
68 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment