NexusFi: Find Your Edge


Home Menu

 





SetCustomFitnessValue() keyword in your strategy


Discussion in Traders Hideout

Updated
    1. trending_up 3,611 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 fiverr 
Calgary
 
Experience: None
Platform: TradeStation, MT4
Trading: ES, Stocks
Posts: 73 since Aug 2015
Thanks Given: 4
Thanks Received: 11

Hi there,

I am testing and optimizing my strategy from 2000 to 2016; however, I would to pay attention to a certain period. This is what I have in mind:

 
Code
	  

total_profit_selected_range = from 2004.06.14 to 2005.12.01
	         FitnessVal =  StrategyPerformance.NetProfit / (-StrategyPerformance.MaxStrategyDrawDown)* total_profit_selected_range
         SetCustomFitnessValue(FitnessVal);
Can someone show me how to implement this?


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
March Jobs Report Update: 178K Beat vs 59K Expected, Wag …
Traders Hideout
April Jobs Beat Flips Fed Hike Odds Past 52% for First T …
Traders Hideout
After $87M Settles NO: Irans Nuclear Redline Sets Up the …
Prediction Markets & Event Contracts
More Than Capable: Hegseths War Warning Validates $114M …
Prediction Markets & Event Contracts
Pakistan Mediator in Tehran as Hormuz Normalization Coll …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 fiverr 
Calgary
 
Experience: None
Platform: TradeStation, MT4
Trading: ES, Stocks
Posts: 73 since Aug 2015
Thanks Given: 4
Thanks Received: 11


here is what I am thinking

 
Code
 If Date => ELDate(2004, 06, 14)AND Date <=ELdate(2005,12,01) Then
      begin
      total_profit_selected_range = NetProfit + yesterdaynet;
     end;


     FitnessVal =  StrategyPerformance.NetProfit / (-StrategyPerformance.MaxStrategyDrawDown)* total_profit_selected_range
         SetCustomFitnessValue(FitnessVal);


Started this thread Reply With Quote
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

fiverr,

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.

 
Code
 If Date => ELDate(2004, 06, 14)AND Date <=ELdate(2005,12,01) Then
      begin
      total_profit_selected_range = NetProfit + yesterdaynet;
     end;
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.

Regards,

ABCTG


Follow me on X Reply With Quote
  #5 (permalink)
 fiverr 
Calgary
 
Experience: None
Platform: TradeStation, MT4
Trading: ES, Stocks
Posts: 73 since Aug 2015
Thanks Given: 4
Thanks Received: 11

ABCTG,

Originally, I was thinking of implementing this in the custom optimization criteria.

if (StrategyPerformance.MaxStrategyDrawDown != 0)
{ return StrategyPerformance.NetProfit / (-StrategyPerformance.MaxStrategyDrawDown); * total_profit_selected_range }


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.


Started this thread Reply With Quote
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

fiverr,

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.

Regards,

ABCTG


Follow me on X Reply With Quote




Last Updated on May 30, 2016


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts