Multicharts SetCustomFitnessValue for Equity Curve - futures io
futures io futures trading



Multicharts SetCustomFitnessValue for Equity Curve


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one benharrell with 1 posts (0 thanks)
    2. looks_two Jura with 1 posts (0 thanks)
    3. looks_3 treydog999 with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,853 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 4 posts
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

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

 
Search this Thread
 

Multicharts SetCustomFitnessValue for Equity Curve

(login for full post details)
  #1 (permalink)
Pittsburgh, Pa
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Zen-Fire
Trading: CL,ES,6E
 
benharrell's Avatar
 
Posts: 235 since Aug 2009
Thanks: 350 given, 96 received

I am in the process of trying to figure out how to use the SetCustomFitnessValue in MC to optimize a specific system for a more linear equity curve. I have done some searching on the Multicharts forum, and here, and can't seem to find anyone trying or producing any examples. I did find an old EasyLanguage post, if you search on google for "set custom fitness value equity curve"

The resulting signal that I produced using code from that Forum (Kreslik), was:

 
Code
vars: 
   vTotalBars(0), 
   vAvgBarEqGrowth(0), 
   vAvgLinShift(0), 
   vLinEquity(0), 
   vMaxDev(0), 
   FitnessVal(0),
   tDiffSum(0), 
   tCounter(0); 

arrays: 
   aCumEquity[](0); 

if BarNumber >= 1 then 
   begin 
      Array_SetMaxIndex(aCumEquity, BarNumber); 
      aCumEquity[BarNumber] = NetProfit + OpenPositionProfit; 
      vTotalBars = BarNumber; 
   end;
   
if (numwintrades + numlostrades) > 0 then 
      begin 
         vAvgBarEqGrowth = aCumEquity[vTotalBars] / vTotalBars; 
         vLinEquity = vAvgBarEqGrowth; { linear equity at bar 1 
            will be equal to the average bar equity growth value} 

         for tCounter = 1 to vTotalBars 
            begin 
               tDiffSum = tDiffSum + (aCumEquity[tCounter] - vLinEquity); 
               vLinEquity = vLinEquity + vAvgBarEqGrowth; 
            end; 

         vAvgLinShift = tDiffSum / vTotalBars; { average deviation 
            from the perfectly linear, though shifted equity curve} 
         vLinEquity = vAvgBarEqGrowth; 

         for tCounter = 1 to vTotalBars 
            begin 
               vMaxDev = MaxList(vMaxDev, 
                  AbsValue(aCumEquity[tCounter] - (vLinEquity + vAvgLinShift))); 
               vLinEquity = vLinEquity + vAvgBarEqGrowth; 
            end; 

         FitnessVal = aCumEquity[vTotalBars] / vMaxDev; 
         SetCustomFitnessValue(FitnessVal);
      end;
The result was that MultiCharts crashed, I am using the most recent version of MC 8 64bit. I am not the best with EasyLanguage, but I am interested in finding out how to fix this. This is pretty experimental on my part, I don't know if it even makes sens to try and optimize for an equity curve alone.

If anyone is interested in helping, it might be great for the community to get this going.

By the way, I didn't post the link tot he forum where the code originated but would be willing to if it was allowed/required.

Visit my futures io Trade Journal Started this thread Reply With Quote

Journal Challenge February 2021 results:
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(173 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(120 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(35 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #3 (permalink)
near Paris, France
 
Experience: Beginner
Platform: -
Trading: -
 
Nicolas11's Avatar
 
Posts: 1,071 since Aug 2011
Thanks: 2,232 given, 1,751 received


Hi,

It is the first time I use custom fitness. But, this is something I wanted to test. So I take the opportunity of your message.

As you can see in the code, an array is created (aCumEquity). Its size is the number of bars on the screen. So, it may be huge. But should be OK.

However, at each bar, the code traverses twice all the existing bars on the screen: "for tCounter = 1 to vTotalBars". This is what seems strange to me. It generates an enormous amount of calculation.

On my computer, the implementation of a simple strategy (unprofitable MA crossover) takes a lot of time. And my computer has more or less frozen when I tried an optimization.

Do you think that the code within "if (numwintrades + numlostrades) > 0 [...] end" shall be executed at each bar, or only at the last?

If your answer is "only at the last", you could try to replace by "if LastBarOnChart AND (numwintrades + numlostrades) > 0 [...] end" and see what happens.

On my computer, it allowed a quick optimization (UPDATE: see screenshot below). But you have to check that the code is still fulfilling its purpose.

Nicolas


Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Nicolas11 for this post:
 
(login for full post details)
  #4 (permalink)
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
 
treydog999's Avatar
 
Posts: 896 since Jul 2012
Thanks: 291 given, 1,027 received

I was looking on how to do this myself. I found a feature request put in by @BigMike on the multicharts Project Manager it says released. But i cant find it in the custom or pull down menu for optimization? Anyone figure out how to use it yet?

MultiCharts Project Management - Issue MC-896 - New optimization type - linear equity curve with minimal deviation

Reply With Quote
 
(login for full post details)
  #5 (permalink)
The Netherlands
 
Experience: None
Platform: MultiCharts, TradingView
Trading: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 688 received


treydog999 View Post
I was looking on how to do this myself. I found a feature request put in by @BigMike on the multicharts Project Manager it says released. But i cant find it in the custom or pull down menu for optimization? Anyone figure out how to use it yet?

MultiCharts Project Management - Issue MC-896 - New optimization type - linear equity curve with minimal deviation

It's available on the forum here. There's also a MC .NET version created by the same user.

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Multicharts SetCustomFitnessValue for Equity Curve


Last Updated on September 6, 2013


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

New Challenge (TBD)

April
     



Copyright © 2021 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