Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

How does the OnStart method works in Historical Tester?
 Post subject: How does the OnStart method works in Historical Tester? Post rating: 0   New post Posted: Fri 03 Aug, 2012, 01:50 
User avatar

User rating: 1
Joined: Tue 01 May, 2012, 22:05
Posts: 17
Location: United Kingdom, London
Hello,

I am programming a tool that will help me manage my trades(calculates lot sizes, place the take profits,..) automatically. The only thing I have to do is drag some lines(entry Line, stop loss line) and the program automatically sets the take profit line(this is a parameter 1:1,1:2,...) and manage the orders.
The entry Line and stop loss line are drawn by the OnStart method. They uses chart Prices as default values, "live" it works perfectly(charts already open), but with the tester the lines don't appear. I think this is because when the OnStart method is called by the tester there isn't yet a chart.
Is there a way to make the Onstart method wait until the tester opens the chart?
It worked when I drew the lines in the Ontick method but I don't think its a good solution is there another way?

Another question: is there a way to change parameters when testing? I made a check box "goLive" so when I am dragging the lines they don't accidentally open a trade until they are placed correctly. Then I change the parameter goLive too "true" in the strategies tab, but this doesn't exist in the historical tester.

Kind Regards Stephane

part of my code in the onstart method:
EP = chart.priceMax(0) - (chart.priceMax(0) - chart.priceMin(0))*0.7;
entryLine = factory.createHorizontalLine("entryLine",EP);


 
 Post subject: Re: How does the OnStart method works in Historical Tester? Post rating: 0   New post Posted: Fri 03 Aug, 2012, 07:47 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
StephanePaulus wrote:
I think this is because when the OnStart method is called by the tester there isn't yet a chart. Is there a way to make the Onstart method wait until the tester opens the chart?
If this really the case, then as a possible workaround consider waiting until IChart.priceMax >0.
StephanePaulus wrote:
Another question: is there a way to change parameters when testing? I made a check box "goLive" so when I am dragging the lines they don't accidentally open a trade until they are placed correctly. Then I change the parameter goLive too "true" in the strategies tab, but this doesn't exist in the historical tester.
You can't change paramaters during the historical tester. Consider putting a checkbox either in your own tab or in a dialog, see:
https://www.dukascopy.com/wiki/#Extending_User_Interface/Bottom_tab_with_a_tick_counter


 
 Post subject: Re: How does the OnStart method works in Historical Tester? Post rating: 0   New post Posted: Fri 03 Aug, 2012, 13:48 
User avatar

User rating: 1
Joined: Tue 01 May, 2012, 22:05
Posts: 17
Location: United Kingdom, London
The bottom tab doesn't work if I am using the historical tester. When not back testing my code the bottom tab works fine.


 
 Post subject: Re: How does the OnStart method works in Historical Tester? Post rating: 0   New post Posted: Fri 03 Aug, 2012, 14:08 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Then put the panel in a JFrame, instead of bottom tab, as in the next example in the same section.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com