# LUA and Kelly Criterion formula

LUA and Kelly Criterion formula
A coding sample

function round4(anum)
return math.floor(anum * 10000) / 10000
end

function kelly_invest(bankroll, winProb, oddsRatio)
local lossProb = 1 – winProb
local kellyPerc = winProb – ((1 – winProb) / oddsRatio)
local recomendInvest = bankroll * kellyPerc
return kellyPerc, recomendInvest
end

function odds_ratio(avgOnWin, avgOnLoss)
return avgOnWin / avgOnLoss
end

function test_kelly()
function kelly_testp(bankroll, winProb, oddsRatio)
kp, ri = kelly_invest(bankroll, winProb, oddsRatio)
print( “kelly — bankroll=” .. bankroll .. ” winProb=” .. winProb
.. ” oddsRatio=” .. round4(oddsRatio) .. ” Kelly Ratio=” .. round4(kp)
.. ” Kelly Investment=” .. round4(ri) )
end

— Convert our Average Win / Loss to a Payout
local avgWin = 185.32
local avgLoss = 210.13
local odr = odds_ratio(avgWin,avgLoss)
print(“avgWin=” .. avgWin .. ” avgLoss=” .. avgLoss .. ” oddsRatio=” .. round4(odr))

— Calcuate Kelly Investment for some test conditions
kelly_testp(1000, 0.56, odr)
kelly_testp(1000, 0.71, odr )
kelly_testp(1000, 0.71, 1.2)
kelly_testp(1000, 0.71, 0.7)
kelly_testp(1000, 0.60, 1.0)
end

test_kelly()

http://bayesanalytic.com/

http://www.albionresearch.com/kelly/default.php

Thanks to Sholom for sending

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

# Last call for Equity pair trading/arbitrage: Kelly Criterion Tuesday nite

Last call for Equity pair trading/arbitrage: Kelly Criterion Tuesday nite

Last call! If you are interested in this Equity Arbitrage/Pair Trading strategy with video demos and source code, this is it. We are at last call! I just posted the login info for our last LIVE webinar on this topic for all my Quant Elite members which you need to be to attend. I will not repeat this anywhere any more as I transition into a data analytics service in coming months. If interested, get details on this course here:

(I’m dropping this option VERY soon so this will be one of your very last chances to get the monthly membership)

Huge savings are available right now on both long term memberships. But I’ll be reducing the number of bonus months available when I cut the monthly option.

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

# Kelly Criterion for basic risk management and self adapting money management

Kelly Criterion for basic risk management and self adapting money management

This is basic risk management for a script to start risk management in your automated trading using this cool

Get the script and source code walkthrough in my Quant Elite membership

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

# Kelly Criterion Javascript demos

Kelly Criterion Javascript demos

This just came in from a newsletter subscriber when I sent out my email on Kelly Criterion

https://dl.dropboxusercontent.com/u/217878013/Finance/KellyCriterion.html

It essentially uses Kelly Criterion to determine how much of a given account to invest in each trade, given the specific assumptions. Primarily this is used to figure out many equi-weighted positions to take on for a basket trade.

Here’s another one that’s entertaining:https://dl.dropboxusercontent.com/u/217878013/Finance/LogRandom.html

That one just plots a theoretical set of trades to try and understand the potential distribution.

And finally another one:https://dl.dropboxusercontent.com/u/217878013/Finance/MonteCarlo.html

This one I coded up after having read Nassim Taleb’s Fooled by Randomness. I wanted to see if I could model the random occurrence of a sequence of losing trades that would result in the total meltdown of one’s account.

join my FREE newsletter to see other cool trading community code demos

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

# Kelly Criterion formula walkthru from Excel to C++

I have another demo to show you today. This one is of many that I’m currently working on for both my Forex trading system as well as my glorified pair trading strategy I am rewriting for C++. I’m hoping both will be online in coming months. Any ways I made this video to demonstrate the Kelly Criterion as well as talk about my approach to how I will distribute this trading system.

Go here to see this quick video demonstration

# Quant Elite Annual Membership “Boxing Day” Week Sale

Also, I would like to mention that here in Canada that we have something called the “Boxing Day” sale week. You know, it’s that time of the year when you return all those ugly sweaters that you don’t want so you can get what you want. As a result, I’ve put it on again this week only for my Quant Elite membership. If you get it now, you don’t have to wait until June 2017. Also, I highly doubt you will ever see this discount ever again as I will be moving into more expensive options throughout 2016

Get on this action now

Here are some of the benefits listed

Bryan

P.S. I am doing a LIVE Question and Answer on this Membership in my Year End Trading “wrap” LIVE this Monday night.

Go here for the details

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

# Kelly Criterion formula walkthru from Excel to C++

Kelly Criterion formula walkthru from Excel to C++

Just an example of many formula used for both forex and glorified equities trading

Join my FREE newsletter to learn how this will be implemented for an automated trading system

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

# Custom risk management tools Beta Kelly Criterion Position weighting

Custom risk management tools Beta Kelly Criterion Position weighting

Very important set of custom source code I worked on in the past

This all available for my ELITE MEMBERS.

Become part of our ELITE training include our NEW FUTURE systematic trading models. BE AN ELITE HERE

My Meetup will focus on this in the next few days

### My Risk Management Toolbox Arsenal

Monday, May 25, 2015, 7:00 PM

GotoMeeting Webinar online
GotoMeeting Webinar online Toronto, ON

My Risk Management Toolbox Arsenal I will be talking about what I have as options for my risk management in this new automated trading system I am building. I will detail more as we get closer to the date. My demos will be done in Matlab.

### My Risk Management Toolbox Arsenal

Monday, May 25, 2015, 7:00 PM

Location details are available to members only.

8 Members Went

My Risk Management Toolbox Arsenal I will be talking about what I have as options for my risk management in this new automated trading system I am building. I will detail more as we get closer to the date. My demos will be done in Matlab.

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

# Self adapting with Kelly Criterion to a portfolio with automated trading performance with P and L

Self adapting with Kelly Criterion to a portfolio with automated trading performance with P and L

How are we doing in this trading account ?

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

# Video Demo showing Kelly Criterion for money management in all your automated trading system needs

Video Demo showing  Kelly Criterion for money management in all your automated trading system needs

This basic money management technique as explained at this link

Join my FREE newsletter to learn other important risk management techniques

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

# My Postgres SQL for positions to test this Kelly Criterion Matlab script for self imposed risk management during trading

My Postgres SQL for positions to test this Kelly Criterion Matlab script for self imposed risk management during trading

Nothing special but use Razor SQL to save yourself a hassles of manually typing this up in some shell script

INSERT INTO test.test.positions
(idx, longentryprice, longentrytimestamp, longentrytimestr, longexitprice, longexittimestamp, longexittimestr, longlowstop, longlowtarget, longsofttargperc, longstoplossper, longsymbol, longupstop, longuptarget, shortentryprice, shortentrytimestamp, shortentrytimestr, shortexitprice, shortexittimestamp, shortexittimestr, shortlowstop, shortlowtarget, shortsofttargperc, shortstoplossper, shortsymbol, shortupstop, shortuptarget)
VALUES
(1, ’10’, 0, ‘0’, ’15’, 0, ‘0’, ‘0’, ‘0’, 0, 0, ‘F’, ‘0’, ‘0’, ‘1’, 0, ‘0’, ‘1.5’, 0, ‘0’, ‘0’, ‘0’, 0, 0, ‘GM’, ‘0’, ‘0’)

or use this:

INSERT INTO test.test.positions
(idx, longentryprice, longentrytimestamp, longentrytimestr, longexitprice, longexittimestamp, longexittimestr, longlowstop, longlowtarget, longsofttargperc, longstoplossper, longsymbol, longupstop, longuptarget, shortentryprice, shortentrytimestamp, shortentrytimestr, shortexitprice, shortexittimestamp, shortexittimestr, shortlowstop, shortlowtarget, shortsofttargperc, shortstoplossper, shortsymbol, shortupstop, shortuptarget)
VALUES
(1, ’10’, 0, ‘0’, ’15’, 0, ‘0’, ‘0’, ‘0’, 0, 0, ‘IBM’, ‘0’, ‘0’, ‘1’, 0, ‘0’, ‘1.5’, 0, ‘0’, ‘0’, ‘0’, 0, 0, ‘AAPL’, ‘0’, ‘0’)

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!