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:
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.
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
The following user says Thank You to Nicolas11 for this 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?