NexusFi: Find Your Edge


Home Menu

 





Help : Method + Switch


Discussion in NinjaTrader

Updated
    1. trending_up 2,818 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

Help : Method + Switch

  #1 (permalink)
 wkmetal 
HK
 
Experience: Intermediate
Platform: NinjaTrader
Posts: 2 since Aug 2009
Thanks Given: 1
Thanks Received: 1

hello
any expert kind to point me the code :
method + switch (method)

example:

private bool abc()
{ return (
switch (expression)
{
case 1: if ( xy() ) {return true;} break;
case 2: if ( yz() ) {return true;} break;

}
)
}
===============
where xy() and yz() are bool

thanks a lot

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Is there a way to simulate CONTINUOUS CONTRACT?
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
MC PL editor upgrade
MultiCharts
Footprint for strategy Builder
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Funded Trader platforms
33 thanks
Spoo-nalysis ES e-mini futures S&P 500
16 thanks
GFIs1 1 DAX trade per day journal
15 thanks
The Trading Pit "Futures VIP" Account Journal
15 thanks
Trading with Intuition
14 thanks
  #3 (permalink)
 traderwerks   is a Vendor
 
Posts: 692 since Jun 2009
Thanks Given: 436
Thanks Received: 465



wkmetal View Post
hello
any expert kind to point me the code :
method + switch (method)

example:

private bool abc()
{ return (
switch (expression)
{
case 1: if ( xy() ) {return true;} break;
case 2: if ( yz() ) {return true;} break;

}
)
}
===============
where xy() and yz() are bool

thanks a lot

我不懂你的邏輯。你要不要這樣子嗎?

 
Code
                 switch (expression)
                              {
                                 case 1: if ( xy() ) {ret = true;} break;
                                 case 2: if ( yz() ) {ret = true;} break;
				default: $ret = false ;
                                }
	return ret ;
And using default is also a good idea.

Reply With Quote
Thanked by:
  #4 (permalink)
 wkmetal 
HK
 
Experience: Intermediate
Platform: NinjaTrader
Posts: 2 since Aug 2009
Thanks Given: 1
Thanks Received: 1

hi,
many thanks your reply, yes, as you said , i must figure my logic first
but your suggestion seem work for me. you are number one

Started this thread Reply With Quote
Thanked by:




Last Updated on October 25, 2010


© 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