NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 01-29-2010, 02:46 AM   #1
kaywai
Senior Member
 
Join Date: Sep 2009
Posts: 562
Thanks: 40
Thanked 5 times in 4 posts
Default Regions and private voids

Hi
1) if I break up my code into regions, how do I instruct the code to move for example from region A to region B?
2) can regions and their code be written under the protected override void OnBarUpdate section?
3) are private void subsections of regions?
4) how do I instruct code to move from private void A to private void B if conditions are fulfilled?

Thanks

Kay Wai
Last edited by kaywai; 01-29-2010 at 02:52 AM.
kaywai is offline  
Reply With Quote
Old 01-29-2010, 05:10 AM   #2
Baruch
Senior Member
 
Join Date: Mar 2009
Posts: 442
Thanks: 0
Thanked 25 times in 16 posts
Default

Hi,
You need functions not regions. Regions are just some code that you wrap to make it visualy nicer. It does nothing!
You need functions. Like in OnBarUpdate you put ABC();
and outside the OnBarUpdate you write the function with its logic:
protected void ABC()
{
here is your logic
}

Baruch
Baruch is offline  
Reply With Quote
Old 01-29-2010, 07:50 AM   #3
kaywai
Senior Member
 
Join Date: Sep 2009
Posts: 562
Thanks: 40
Thanked 5 times in 4 posts
Default

Thanks Baruch! I see them in some ninjascripts that some guys have written and some of them have it done like nothing i've seen before. One programmer had "this" almost on every line as well as a few regions and private voids and it seemed that he was using "this" to move from private void to private void. Another thing is when i put in a region under OnBarUpdate, i tend to get an error message...
kaywai is offline  
Reply With Quote
Old 01-29-2010, 08:16 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

Kay, this is unfortunately out of the scope that we can provide support for (more general C#), so if you want to dive into those concepts further we would suggest to review a C# introductory book.
NinjaTrader_Bertrand is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why regions not collapsable any more? saroj Indicator Development 2 10-02-2009 05:56 PM
Increase private message storage on forum ctrlbrk Suggestions And Feedback 4 03-23-2009 05:54 PM
Variables: "public" vs. "private"?? zeller4 General Programming 2 12-01-2008 09:52 AM
Is it possible to create a private indicator? ooppie General Programming 2 05-26-2008 11:36 PM


All times are GMT -6. The time now is 06:54 PM.