Page 1 of 1

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

Posted: Sun Mar 12, 2017 7:36 am
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!

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

Posted: Sun Mar 12, 2017 10:02 am
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

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

Posted: Sun Mar 12, 2017 4:07 pm
by flare9x
Is there anyway I can do this inside formulas?