Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
where do you plan to implement this in MC? The code appears to be a mix of EasyLanguage and the code used for setting custom criteria - these won't work together as far as I am aware.
You can set the value for SetCustomFitnessValue directly with reserved words in the code.
If you take a look at your code below, I am not sure it would give you the result you are looking for.
Assuming you go flat into the time period (with an open position it would be more complex), shouldn't the total_profit during the range be the NetProfit at the end of the range - Netprofit before the range. Which might be what your formula gives you, but it's not clear what value yesterdaynet holds.
I was told that there is no way of calculating total_profit_selected_range (profit from date x to date y) in the custom optimization criteria. The only solution is to use the SetCustomFitnessValue inside my PowerLanguage script. I am trying to get some direction on how to calculate profit from date x to date y inside my strategy script.
in my opinion you have much more control and possibilities when doing it via SetCustomFitnessValue in the code directly. The first step should be to compute the value for the total_profit_selected_range variable and as I wrote in my post above it's not clear if you get the correct value for that.