Kelly Money Management Multicharts [EXCEPTION} Floating-point invalid operation.
futures io futures trading


Kelly Money Management Multicharts [EXCEPTION} Floating-point invalid operation.
Updated: Views / Replies:155 / 2
Created: by BrianMichaelWall Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Kelly Money Management Multicharts [EXCEPTION} Floating-point invalid operation.

  #1 (permalink)
Kitchener Ontario Canada
 
 
Posts: 1 since Mar 2020
Thanks: 0 given, 0 received

Kelly Money Management Multicharts [EXCEPTION} Floating-point invalid operation.

I've coded a Kelly money management signal for Multicharts off of the risk capital set and I've been getting the error: [EXCEPTION} Floating-point invalid operation.

I've searched for the solution, and found that others have gotten around the problem by removing the scenario where their equation divides by zero.

I've tried to identify where there is a zero that I'm dividing by, and attempted to add exceptions however the error persists.

I havn't put any code in my signal code to associate to the money management code.

Any advice is appreciated.

//#Number of Units = Account Total * Risk Capital * ( Kelly Ratio % - Win % Change Buffer )
//Kelly Ratio = % of trades that win - (1 - % of trades that win) / ($ Winnings per trade / Expected Loss per trade)

---------------------------------------------------------------------------------------------------

Vars:
GL( 0 ),
GP( 0 ),
NWT( 0 ),
TT( 0 ),
Tradevolume( 0 ),
Equity( 0 ),
ProfitFactor( 0 ),
WTP( 0 ),
KellyCriterion( 0 ),
Kelly( 0 );

//Equity
Equity = Round ((InitialCapital + NetProfit + OpenPositionProfit),0);


//Kelly Criterion Variables
GL = grossloss/numlostrades;
GP = grossprofit/numwintrades;
NWT = Numwintrades;
TT = Totaltrades;

//Kelly Criterion Calculation
kelly[(NWT/TT) - (1-(NWT/TT)/(GP/GL))];

//Entries
If Entryprice > 0
Then pmms_strategy_set_entry_contracts(0,((Equity * Kelly)/Entryprice));

//Exceptions
IF GL=0 then raiseruntimeerror("!!!alarm GL=0");
IF GP=0 then raiseruntimeerror("!!!alarm GP=0");
IF NWT=0 then raiseruntimeerror("!!!alarm NWT=0");
IF TT=0 then raiseruntimeerror("!!!alarm TT=0");
IF Tradevolume=0 then raiseruntimeerror("!!!alarm Tradevolume=0");
IF Equity=0 then raiseruntimeerror("!!!alarm Equity=0");
IF ProfitFactor=0 then raiseruntimeerror("!!!alarm ProfitFactor=0");
IF WTP=0 then raiseruntimeerror("!!!alarm WTP=0");
IF KellyCriterion=0 then raiseruntimeerror("!!!alarm KellyCriterion=0");
IF Kelly=0 then raiseruntimeerror("!!!alarm Kelly=0");
If Entryprice = 0 then raiseruntimeerror("!!!alarm Entryprice=0");

Reply With Quote

Can you help answer these questions
from other members on futures io?
Trailing stop order in MotiveWave?
Platforms and Indicators
coding studies
ThinkOrSwim
Price Levels With Start And End Times
ThinkOrSwim
GetRTAccountEquity - EasyLanguage, MultiCharts, Daily Account P&L
MultiCharts
Need help to code these studies
ThinkOrSwim
 
Best Threads (Most Thanked)
in the last 7 days on futures io
ES futures Spoo-nalysis SP500/SPX
247 thanks
Recession? Depression? Bailout!
226 thanks
Coronavirus COVID-19
217 thanks
Finally Turning the Corner, tha "its 80% Psychology" thing...
82 thanks
Understanding Footprint Charts / Number bars
69 thanks
 
  #2 (permalink)
 Vendor: www.abctradinggroup.com 
Hamburg Germany
 
Trading Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 2,163 since Apr 2013
Thanks: 384 given, 1,396 received

BrianMichaelWall,

it's a good practice to add checks for every division done within your code. The code snippet below contains several divisions without "protective" checks and these might cause the error.

Without any trades any reserved word returning the number of trades (or winning/losing trades) will return zero for example.

Regards,

ABCTG


BrianMichaelWall View Post
I've coded a Kelly money management signal for Multicharts off of the risk capital set and I've been getting the error: [EXCEPTION} Floating-point invalid operation.

I've searched for the solution, and found that others have gotten around the problem by removing the scenario where their equation divides by zero.

I've tried to identify where there is a zero that I'm dividing by, and attempted to add exceptions however the error persists.

I havn't put any code in my signal code to associate to the money management code.

Any advice is appreciated.

//#Number of Units = Account Total * Risk Capital * ( Kelly Ratio % - Win % Change Buffer )
//Kelly Ratio = % of trades that win - (1 - % of trades that win) / ($ Winnings per trade / Expected Loss per trade)

---------------------------------------------------------------------------------------------------

Vars:
GL( 0 ),
GP( 0 ),
NWT( 0 ),
TT( 0 ),
Tradevolume( 0 ),
Equity( 0 ),
ProfitFactor( 0 ),
WTP( 0 ),
KellyCriterion( 0 ),
Kelly( 0 );

//Equity
Equity = Round ((InitialCapital + NetProfit + OpenPositionProfit),0);


//Kelly Criterion Variables
GL = grossloss/numlostrades;
GP = grossprofit/numwintrades;
NWT = Numwintrades;
TT = Totaltrades;

//Kelly Criterion Calculation
kelly[(NWT/TT) - (1-(NWT/TT)/(GP/GL))];

//Entries
If Entryprice > 0
Then pmms_strategy_set_entry_contracts(0,((Equity * Kelly)/Entryprice));

//Exceptions
IF GL=0 then raiseruntimeerror("!!!alarm GL=0");
IF GP=0 then raiseruntimeerror("!!!alarm GP=0");
IF NWT=0 then raiseruntimeerror("!!!alarm NWT=0");
IF TT=0 then raiseruntimeerror("!!!alarm TT=0");
IF Tradevolume=0 then raiseruntimeerror("!!!alarm Tradevolume=0");
IF Equity=0 then raiseruntimeerror("!!!alarm Equity=0");
IF ProfitFactor=0 then raiseruntimeerror("!!!alarm ProfitFactor=0");
IF WTP=0 then raiseruntimeerror("!!!alarm WTP=0");
IF KellyCriterion=0 then raiseruntimeerror("!!!alarm KellyCriterion=0");
IF Kelly=0 then raiseruntimeerror("!!!alarm Kelly=0");
If Entryprice = 0 then raiseruntimeerror("!!!alarm Entryprice=0");


Follow me on Twitter Visit my Facebook Reply With Quote
 
  #3 (permalink)
Basking Ridge
 
 
Posts: 4 since Mar 2020
Thanks: 1 given, 6 received


I'm new to Easylanguage but I notice that you're checking for 0 values after you do the divisions therefore the exception gets thrown and execution halts before you check for 0 values.. You might find the offending 0 value if you move the divisions below after checking for 0 values.

Typically you would check for zero in an if statement before conducting the division.

Reply With Quote

Reply



futures io Trading Community Platforms and Indicators MultiCharts > Kelly Money Management Multicharts [EXCEPTION} Floating-point invalid operation.




Upcoming Webinars and Events (4:30PM ET unless noted)
 

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Coding problem, Multicharts.net, Using function entry point values as exit point shamanov Traders Hideout 10 January 19th, 2018 03:11 PM
Floating point invalid operation? hughesfleming MultiCharts 4 June 15th, 2017 10:00 AM
Floating-Point division rawos EasyLanguage Programming 4 October 21st, 2016 03:04 AM
Webinar: Ernest Chan on Capital Allocation and Risk Management (Kelly) Big Mike Psychology and Money Management 27 May 2nd, 2016 06:06 PM
{Exception}Floating-Point division by zero, signal only. RickW EasyLanguage Programming 2 September 22nd, 2015 03:13 AM


All times are GMT -4. The time now is 10:21 AM. (this page content is cached, log in for real-time version)

Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts