Strategy Position keywords and optimization  [SOLVED]

Questions about MultiCharts and user contributed studies.
evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Strategy Position keywords and optimization

Postby evdl » 06 Mar 2013

Is it possible to use the keywords like:

* OpenEntryTime
* EntryTime
* EntriesToday
etc.

with optimization?

I have two trailingstop systems. One for the first trade of the day and another for the second and consecutive trades on a day. With the entrytime and entriestoday keywords I determine when the first or the second trailingstop system must be used. In backtesting this works ok. When trying to optimize the trailingstops (using optimiser on the chart in MC). Then it will run like normal, except it will create only 0 values in the output report.

If I use one trailingstop system and therefore not using the position keywords, optimizing works ok. That's why I question the use of these keywords with optimizing.

Can anyone confirm using these keywords with optimizing?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Strategy Position keywords and optimization  [SOLVED]

Postby Henry MultiСharts » 07 Mar 2013

Hello evdl,

These reserved words work during optimization (they return values like in backtesting).
How exactly do you want to use these reserved words during optimization?

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: Strategy Position keywords and optimization

Postby evdl » 07 Mar 2013

Hi Henry,

This is the code I use to switch from one TS system to the second TS system

Code: Select all

If EntriesToday(date) > 1 or (OpenEntryTime >= Begin_time_entry_2 and OpenEntryTime <= End_time_entry_2) then begin
First_trade_trigger = false;
end
Else begin
First_trade_trigger = true;
end;

If first_trade_trigger then begin

Code of trailingstop system of the first trade here
Trigger for the second TS system

Code: Select all

If EntriesToday(date) >= 2 or (OpenEntryTime >= Begin_time_entry_2 and OpenEntrytime <= End_time_entry_2) then begin
second_trade_trigger = true;
end
Else begin
second_trade_trigger = false;
end;

If second_trade_trigger then begin

Code of trailingstop system of the second trade here
The openentrytime and entriestoday are used to switch between the TS system of the first trade of the day and the second trade of the day (two trades in total per day).

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Strategy Position keywords and optimization

Postby Henry MultiСharts » 15 Mar 2013

Hello evdl,

Please provide more details on the exact concept you are tring to implement. What do you mean exactly by "to switch between the TS system"?

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: Strategy Position keywords and optimization

Postby evdl » 15 Mar 2013

Thanks for your reply Henry,

I understand that the position keywords must work with optimization, so it must be something in my code.

I will check my code first, to prevent taking your time, possible for a coding error on my side.

Topic solved for now I guess.


Return to “MultiCharts”