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




 
Search this Thread
  #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,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,583

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

Can you help answer these questions
from other members on NexusFi?
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
Roland Garros Final Day: $3M on Zverev at 80.5% -- Leban …
Prediction Markets & Event Contracts
Weekend Update: First Qatari LNG Transit Attempted -- IR …
Traders Hideout
Warsh Rate Hike at 40%, Iran June 15 Expires Tonight at …
Prediction Markets & Event Contracts
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #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,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,583


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 X 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


© 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