NexusFi: Find Your Edge


Home Menu

 





Calculating percent profitable over period


Discussion in EasyLanguage Programming

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




 
Search this Thread

Calculating percent profitable over period

  #1 (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,398 since Jun 2009
Thanks Given: 33,173
Thanks Received: 101,537

Hi guys,

I am trying to create a small bit of code that will calculate the % Profitable (win %) of all trades taken by a signal over a certain period.

Let's keep the first example simple. I just want to calculate the win % for the trades taken so far today (since midnight).

I know we have the PercentProfit reserved word, but that seems worthless here as it is for the entire series length. So then I look at the PosTradeProfit reserved word, which returns a numerical value indicating the profit (or loss if negative) of the specified trade.

With PosTradeProfit, we need to pass the PosAgo (number of positions ago, 0=open), and the TradeNumber within that position.

For my strategy, each position can have up-to 10 trades associated with it.

So far, I am thinking that I need to track:
- Current number of "positions" initiated (trades taken, but relates to PosAgo) -- rollover at midnight
- Number of trades taken within each position, tracked on a per-position basis -- I think we can use PosTradeCount for this, as it returns the number of entries within a position

And then I would create a loop and increment the PosTradeProfit(PosAgo, TradeNumber) first by the most recent position, then by each trade within that position, and so forth.

I would then come back with the total number of profitable trades, and the total number of all trades, and can do the math from there.

Anyone care to help me with this?

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 Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Futures True Range Report
The Elite Circle
ZombieSqueeze
Platforms and Indicators
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
 
  #3 (permalink)
 NW27 
Newcastle, Australia
 
Experience: Intermediate
Platform: Multicharts 8 - Full Version
Broker: IB
Trading: SPI,FTSE100, 6E, 6A
Posts: 285 since Oct 2010
Thanks Given: 108
Thanks Received: 188


Hi Mike
Must be the red wine.
Im confused as to what you are trying to achieve.


Thanks,
Neil.

(Sent from my Galaxy S2 via Tapatalk)

Reply With Quote
  #4 (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,398 since Jun 2009
Thanks Given: 33,173
Thanks Received: 101,537


NW27 View Post
Hi Mike
Must be the red wine.
Im confused as to what you are trying to achieve.


Thanks,
Neil.

(Sent from my Galaxy S2 via Tapatalk)

Complete dataseries length (chart history) = 30 days

I want to know what the win % was for yesterday. After I get the routine written, I will want to be able to calculate the win % for the last 'x' trades or last 'x' days.

That is what I am after. Needs to be done in the signal so I can use the information in the signal itself.

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 Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 KhaosTrader 
San Jose
 
Experience: Intermediate
Platform: NinjaTrader, Esignal
Trading: Stocks
Posts: 107 since Jan 2012
Thanks Given: 40
Thanks Received: 21

Did anyone get this code snippet written? I could use it.

Reply With Quote




Last Updated on March 9, 2013


© 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