Strategy Optimizer acting strangely...

How to create strategies and indicators
Message
Author
User avatar
Tantalus
Posts: 302
Joined: Fri Mar 23, 2007 3:51 pm
Contact:

Strategy Optimizer acting strangely...

#1 Postby Tantalus » Thu Oct 25, 2007 6:02 pm

I created a strategy that calls an indicator using CreateIndicator and GetIndicatorValue. When I run this strategy in the optimizer it opens a new indicator window for every value it tries (because each one uses a different parameter in the indicator). This quickly clogs up the memory and slows the optimization to a crawl. I temporarily solved this problem by hard-coding the indicator into my strategy (it no longer calls an external indicator) but I hope there's a way to avoid doing this with every strategy I write.

It might help if I could get the indicators created by a strategy to be deleted when the strategy is deactivated, but I haven't figured that out (see my previous, unanswered post in this forum)

Can you help me with this, Mike?

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

Re: Strategy Optimizer acting strangely...

#2 Postby Terranin » Thu Oct 25, 2007 7:43 pm

Tantalus wrote:I created a strategy that calls an indicator using CreateIndicator and GetIndicatorValue. When I run this strategy in the optimizer it opens a new indicator window for every value it tries (because each one uses a different parameter in the indicator). This quickly clogs up the memory and slows the optimization to a crawl. I temporarily solved this problem by hard-coding the indicator into my strategy (it no longer calls an external indicator) but I hope there's a way to avoid doing this with every strategy I write.

It might help if I could get the indicators created by a strategy to be deleted when the strategy is deactivated, but I haven't figured that out (see my previous, unanswered post in this forum)

Can you help me with this, Mike?


This situation shouldn't happen, I need to see the code. Strategy optimizer removes all the indicators after each pass.
Hasta la vista
Mike

User avatar
Tantalus
Posts: 302
Joined: Fri Mar 23, 2007 3:51 pm
Contact:

#3 Postby Tantalus » Fri Oct 26, 2007 11:47 am

OK, I've attached the source for the strategy as well as the indicator that it calls. I did a little more testing and here is what I'm seeing:

I run the strategy optimizer, and it works but it gets slower and slower with each passing iteration.

When it's finished, I close the strategy optimizer window and in the testing mode window I click on the indicator list button. It shows that there's an indicator open for each iteration of the indicator that was used.. for example, if I optimize for the indicator parameter 'period' and run it from 3 to 15, there will be an open indicator for each of these values (13 total). But no indicator window is showing on the screen.

Then I click the 'delete all' button, the screen flashes a bit and suddenly all of the indicator windows appear on the screen.. usually it completely covers the price chart. No matter how many times I click the 'delete all' button, it won't delete the indicators..

Then, I close the indicator list dialog, click the connect button (as if I was going to start testing) then I disconnect again. NOW, it will allow me to delete the indicator windows.

I hope this info helps you figure out the problem.
Attachments
RegSlopeStrategy_01.zip
(1.09 KiB) Downloaded 865 times
RegSlope.zip
(811 Bytes) Downloaded 828 times

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

#4 Postby Terranin » Sun Oct 28, 2007 10:59 pm

I tested your code and it works fine. Try to update your Forex Tester it is possible that I updated last build without notification but it was long time ago... But your code works well on my computer, only 1 indicator on every iteration.
Hasta la vista

Mike

User avatar
Tantalus
Posts: 302
Joined: Fri Mar 23, 2007 3:51 pm
Contact:

#5 Postby Tantalus » Mon Oct 29, 2007 1:14 pm

I'm using Version 1, Build 11, downloaded within the last 2 - 3 weeks.

I'll try it with some more indicators and strategies and see if I still get the same results.


Perhaps the indicator object should be destroyed after use ? Is there a way to do this in a strategy code?

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

#6 Postby Terranin » Mon Oct 29, 2007 1:27 pm

Tantalus wrote:I'm using Version 1, Build 11, downloaded within the last 2 - 3 weeks.

I'll try it with some more indicators and strategies and see if I still get the same results.


Perhaps the indicator object should be destroyed after use ? Is there a way to do this in a strategy code?


Your code seems correct. I do not know where is the problem.
Hasta la vista

Mike


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 21 guests