Adding Optimal f to win% . avg gain / avg loss

Discussions about the testing and simulation of mechanical trading systems using historical data and other methods. Trading Blox Customers should post Trading Blox specific questions in the Customer Support forum.
Post Reply
flare9x
Contributor
Contributor
Posts: 3
Joined: Sun Mar 12, 2017 7:33 am

Adding Optimal f to win% . avg gain / avg loss

Post by flare9x »

Hello

I have used a tutorial online to create a monte carlo simulation.

The metrics I have:

win%
avg win
avg loss
worst loss

I am trying to add the optimal f to this and then actually run the monte carlo simulation over the optimal f position size.

How can I achieve this?

Any help is greatly appreciated!
stamo
Roundtable Knight
Roundtable Knight
Posts: 522
Joined: Tue Mar 13, 2007 5:27 pm

Re: Adding Optimal f to win% . avg gain / avg loss

Post by stamo »

very briefly, accumulate the elements of optimal f, calculate it, and then add the stat in the after test script, like this:

Code: Select all

VARIABLES: index, totalWinTrades, totalLoseTrades TYPE: integer

totalWinTrades    = 0
totalLoseTrades   = 0

FOR index = 1 TO test.tradeCount STEP 1
	IF test.tradeProfit[ index ] > 0 THEN
		totalWinTrades = totalWinTrades + 1
	ELSE
		totalLoseTrades = totalLoseTrades + 1
	ENDIF
NEXT

test.AddStatistic( "%Win Trade", (totalWinTrades/test.tradeCount), 0, "percent")



and here's another
flare9x
Contributor
Contributor
Posts: 3
Joined: Sun Mar 12, 2017 7:33 am

Re: Adding Optimal f to win% . avg gain / avg loss

Post by flare9x »

Is there anyway I can do this inside formulas?
Post Reply