Missing something very simple on my code - futures io
futures io futures trading



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 sam028 with 1 posts (2 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Big Mike with 1 posts (1 thanks)
    1. trending_up 2,243 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Missing something very simple on my code

(login for full post details)
  #1 (permalink)
Canada
 
Experience: Advanced
Platform: NT, TS
Broker: Amp
Trading: ES
 
sharp2be's Avatar
 
Posts: 57 since Sep 2009
Thanks: 1 given, 69 received

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 futures io Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
What blockvolume is visible? - order processing
NinjaTrader
Volume Profile Indicator for Ninja Script in NT8
NinjaTrader
Webinar: Finding your own way in trading w/Adam Grimes
The Elite Circle
Improve current ZigZag indicator in NT8
NinjaTrader
Neurological explanations for trading Success
Psychology and Money Management
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Battlestations: Show us your trading desks!
137 thanks
Want your NinjaTrader indicator created, free?
32 thanks
Big Mike in Ecuador
30 thanks
Saturday Morning Market Replay!
20 thanks
Selling Options on Futures?
19 thanks
 
(login for full post details)
  #3 (permalink)
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,665 since Jun 2009
Thanks: 3,787 given, 4,494 received


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 Twitter Reply With Quote
The following 2 users say Thank You to sam028 for this post:
 
(login for full post details)
  #4 (permalink)
Canada
 
Experience: Advanced
Platform: NT, TS
Broker: Amp
Trading: ES
 
sharp2be's Avatar
 
Posts: 57 since Sep 2009
Thanks: 1 given, 69 received


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 futures io Trade Journal Started this thread Reply With Quote
 
(login for full post details)
  #5 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,790 since Jun 2009
Thanks: 32,314 given, 97,610 received


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

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #6 (permalink)
Canada
 
Experience: Advanced
Platform: NT, TS
Broker: Amp
Trading: ES
 
sharp2be's Avatar
 
Posts: 57 since Sep 2009
Thanks: 1 given, 69 received


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 futures io Trade Journal Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Missing something very simple on my code


Last Updated on May 22, 2010


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts