NexusFi: Find Your Edge


Home Menu

 





SetCustomFitnessValue() keyword in your strategy


Discussion in Traders Hideout

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




 
Search this Thread

SetCustomFitnessValue() keyword in your strategy

  #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?
How to apply profiles
Traders Hideout
Exit Strategy
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
22 thanks
GFIs1 1 DAX trade per day journal
17 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,434 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

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 Twitter 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,434 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

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 Twitter Reply With Quote




Last Updated on May 30, 2016


© 2024 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 - Privacy Policy - Downloads - Top
no new posts