NexusFi: Find Your Edge


Home Menu

 





Missing something very simple on my code


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one sharp2be with 3 posts (0 thanks)
    2. looks_two Big Mike with 1 posts (1 thanks)
    3. looks_3 sam028 with 1 posts (2 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,398 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
sharp2be's Avatar
 sharp2be 
Canada
 
Experience: Advanced
Platform: NT, TS
Broker: Amp
Trading: ES
Posts: 57 since Sep 2009
Thanks Given: 1
Thanks Received: 69

Hi everyone , I know I'm missing something very simple here but I'm trying to print the result of a simple calculation and it always prints zero... can anyone help please:

here's my snippet:

Code:
 
Code
    int countWins;
int countAllTrades;
countWins = 10;
countAllTrades = 20;
winPct = 100*(countWins/countAllTrades);
Print("---- probabilities :-) ");
Print("# countAllTrades = " + countAllTrades.ToString() + 
      ", countWins = " + countWins + " (" + winPct.ToString() + ")" ); 
and here's what is printing..
---- probabilities :-)
# countAllTrades = 20, countWins = 10 (0)

not sure why I'm getting zero for the winPct...

Can anyone help please?


Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Topstep Acquires The Futures Desk -- Prop Firm Consolida …
Funded Trading Evaluation Firms
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
The May 31 Binary: 60% Trump Declares Iran Ops Over, Onl …
Prediction Markets & Event Contracts
February NFP Preview -- Why This Mornings Jobs Number Co …
Traders Hideout
Kharg Island at 6%, Regime Fall at 1.5% -- The Black Swa …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
23 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,756 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,632


Because Int/Int => Int

So:
 
Code
                            
winPct 100*countWins/countAllTrades
is better.

Or, if you want to keep the useless/confusing () :
 
Code
                            
winPct 100*((float)countWins/(float)countAllTrades); 


Success requires no deodorant! (Sun Tzu)
Follow me on X Reply With Quote
Thanked by:
  #4 (permalink)
 
sharp2be's Avatar
 sharp2be 
Canada
 
Experience: Advanced
Platform: NT, TS
Broker: Amp
Trading: ES
Posts: 57 since Sep 2009
Thanks Given: 1
Thanks Received: 69


sam028 View Post
Because Int/Int => Int

So:
 
Code
                            
winPct 100*countWins/countAllTrades
is better.

Or, if you want to keep the useless/confusing () :
 
Code
                            
winPct 100*((float)countWins/(float)countAllTrades); 


Sam -- excellent ! I'm back on business. Thank you so much.


Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


sharp2be View Post
Sam -- excellent ! I'm back on business. Thank you so much.

Please remember to press the Thanks button when you find something useful, as a reward to the poster

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #6 (permalink)
 
sharp2be's Avatar
 sharp2be 
Canada
 
Experience: Advanced
Platform: NT, TS
Broker: Amp
Trading: ES
Posts: 57 since Sep 2009
Thanks Given: 1
Thanks Received: 69


Big Mike View Post
Please remember to press the Thanks button when you find something useful, as a reward to the poster

Mike

Did it now. Thanks.


Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on May 22, 2010


© 2026 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 - Downloads - Top
no new posts