NexusFi: Find Your Edge


Home Menu

 





Getting performance report of last N trades


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #1 (permalink)
M4STR0
Florence
 
Posts: 27 since Jan 2021
Thanks Given: 23
Thanks Received: 9

Hello, anyone has an idea on how I could code inside a strategy the print of the profit factor or other performance report factor of the last N trades?


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
Prediction Markets & Event Contracts
One Wallet Made $200K in Hours: AP Probes Polymarket Cea …
Prediction Markets & Event Contracts
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
Kalshi Sets $4.13B All-Time Weekly Record as Polymarket …
Prediction Markets & Event Contracts
Al Arabiya: US-Iran Draft Deal Within Hours Contains Hor …
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
Volume Indicators
8 thanks
BERN ALGOS algo trading journal
8 thanks
  #2 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,737 since Jul 2012
Thanks Given: 1,917
Thanks Received: 7,476


M4STR0 View Post
Hello, anyone has an idea on how I could code inside a strategy the print of the profit factor or other performance report factor of the last N trades?

PositionProfit(X) contains the P/L of previous trades. You could use that to collect the profitable trades and the unprofitable trades and calculate the Profit Factor.

But, it only captures the last 10 trades.

You'd have to create an array to store more values than that.


Follow me on X Reply With Quote
Thanked by:
  #3 (permalink)
 TraderDoc2 
Plainview
 
Experience: Intermediate
Platform: TradeStation
Broker: TradeStation
Trading: Futures
Posts: 37 since Mar 2012
Thanks Given: 2
Thanks Received: 22


This is a code fragment that I have tried for a similar purpose.

Begin with Declarations:

 
Code
Arrays:
	TdResult[1000](0);

Vars:
	RatioAvgToSD(0),
	TotTr(0),
	ProfFractNorm(0),
	J1(0);
	
	
Inputs:
	PrintOutput(True),
	N(30);{Number of Trades to Evaluate}

{Then your main strategy code goes here }

If PrintOutput then begin
	
		TotTr = Totaltrades;
	
		If TotTr > TotTr[1] then begin
			ProfFractNorm = PositionProfit(1)/(EntryPrice(1) * BigPointValue);
			For J1 = 2 to N Begin 
				TdResult[J1-1] = TdResult[J1];
			end;
			TdResult[N] = ProfFractNorm;
			Value1 = AverageArray{[N+1]}(TdResult,N);
			Value2 = StandardDevArray{[N+1]}(TdResult,N,1);
			RatioAvgToSD = IFF(Value2 <> 0, Value1/Value2, -1);
		end;
	
		If LastBarOnChart then begin
			Print(GetSymbolName,"  BarInterval = ",BarInterval,"   Number of Trades Charted = ",TotTr:0:0,"  Number of Trades Considered (last N Trades) = ",N:0:0,"  AvgTrade/StdDev (last N Trades) = ",RatioAvgToSD:0:3);
		end;

end;
You should prefer higher ratios of AvgTrade to Standard Dev.


Follow me on X Reply With Quote




Last Updated on July 20, 2023


© 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