NexusFi: Find Your Edge


Home Menu

 





OptimizationMethod.Iterations is always 1


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 dnof 
san francisco, ca
 
Experience: Intermediate
Platform: NinjaTrader
Posts: 45 since Nov 2009
Thanks Given: 43
Thanks Received: 27

So I have a related question I am trying to solve.

With my strategy I am exporting trade records and performance metrics automatically to two csv files. I have it setup for multi-threaded support and it is works great running in the optimizer. To support ppart of this, I am using some "static" variables for the output file names. These file names are automatically calculated based on instrument and time etc.

The issue I have is that because of the use of statics, the filename does not reset for each new optimization run so I have to manually "move them out of the way".

What I was hoping to do was detect when an optimization was being performed and then using the expected number of iterations (using the base.OptimizationMethod.Iterations) track until I am complete and then reset the static file name.

I would have thought that this OptimizationMethod.iterations property (at least looking at the defaultOptimization code should represent the number of iterations that are required to be performed (i.e. a total count), but when I look at this variable it is always one from within a strategy instances.

Anyone have any ideas on if I am being boneheaded or is there something else I am do instead??


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
BofA Projects $1.1 Trillion in Sports Event Contracts -- …
Prediction Markets & Event Contracts
Prop Firm Tracked Payouts Hit $115M in Q1 but Growth Fla …
Funded Trading Evaluation Firms
Hormuz Normalization Collapses to 19.5% -- Iran Regime F …
Prediction Markets & Event Contracts
Trump Lands in Beijing on CPI Day: Iran Peace Expires To …
Prediction Markets & Event Contracts
Warsh Confirmed 54-45 on PPI Day -- 97% Say He Holds in …
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
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


I can't offer much help, other than to point you towards some other extensive work with optimizers:



Now that code is for 6.5, and is useless for 7 in terms that it won't work. But, you could still analyze the code and possibly learn a few things to do with using your own optimizer.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 dnof 
san francisco, ca
 
Experience: Intermediate
Platform: NinjaTrader
Posts: 45 since Nov 2009
Thanks Given: 43
Thanks Received: 27

Thanks Mike,

I emailed NT also, but it does not seem like there is an easy method inside a Strategy. I could extend/write my own optimizer, which is likely the easiest at stage.

In the interim what I have done is created a "static" that tracks whether a "file name reset" is required, and then just set that to the true in the UI. This works fine, the only issue being that if you forget, you add/overwrite the last files.


Started this thread Reply With Quote




Last Updated on October 5, 2011


© 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