Fake signal to optimize parameters

Questions about MultiCharts and user contributed studies.
Laurent
Posts: 159
Joined: 20 Nov 2010
Location: France
Has thanked: 76 times
Been thanked: 32 times

Fake signal to optimize parameters

Postby Laurent » 07 Feb 2011

Hi,

I want to optimize a trading system to find its best settings.
I need your help for a part of the code ;-)

Let's take a simple example:
I have an indicator which give good buy signals. I want to find best settings to use it.
I would like to create an indicator which sell every high/top after I have this buy signal.
I know it's artificial... but it helps to find the best parameters for my buy indicator.

So, how can I create a signal which gives the high/top price after a buy signal and which sell short?

User avatar
TJ
Posts: 6572
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 968 times
Been thanked: 1901 times

Re: Fake signal to optimize parameters

Postby TJ » 07 Feb 2011

Laurent wrote:Hi,

I want to optimize a trading system to find its best settings.
I need your help for a part of the code ;-)

Let's take a simple example:
I have an indicator which give good buy signals. I want to find best settings to use it.
I would like to create an indicator which sell every high/top after I have this buy signal.
I know it's artificial... but it helps to find the best parameters for my buy indicator.

So, how can I create a signal which gives the high/top price after a buy signal and which sell short?

First, you have to describe your definition of "high/top".

eg.
higher than previous bar's high?
or, higher than all the highs of the previous 5 bars?

also, what is a top?

Laurent
Posts: 159
Joined: 20 Nov 2010
Location: France
Has thanked: 76 times
Been thanked: 32 times

Re: Fake signal to optimize parameters

Postby Laurent » 07 Feb 2011

Hello TJ,

Sorry for my english! Not easy to explain it being froggy ;)

High/Top as I thought => Higher than all the highs on a definite period after my buy signal ( or the first higher after my buy signal, like a peak on Metastock).

--
Laurent

User avatar
TJ
Posts: 6572
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 968 times
Been thanked: 1901 times

Re: Fake signal to optimize parameters

Postby TJ » 07 Feb 2011

Laurent wrote:Hello TJ,

Sorry for my english! Not easy to explain it being froggy ;)

High/Top as I thought => Higher than all the highs on a definite period after my buy signal ( or the first higher after my buy signal, like a peak on Metastock).

--
Laurent

Your English is fine.
If you are concerned, you can always post in your native language.
We will use Google Translate to understand you.
http://translate.google.com/#

Laurent
Posts: 159
Joined: 20 Nov 2010
Location: France
Has thanked: 76 times
Been thanked: 32 times

Re: Fake signal to optimize parameters

Postby Laurent » 07 Feb 2011

Thanks, but I will try to improve myself =)

So to clarify, my last word ;-)
Higher than all the highs on a definite period after my buy signal (like a peak).

User avatar
TJ
Posts: 6572
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 968 times
Been thanked: 1901 times

Re: Fake signal to optimize parameters

Postby TJ » 07 Feb 2011

you can give this a try:

Code: Select all

Input:
look.back(5);

var:
my.high(0);

my.high = highest( high, look.back);


if h > my.high[1] then
sellshort ("SS") next bar at market;



the optimizer will let you run through the "look.back" period to see which is the optimal value.

Laurent
Posts: 159
Joined: 20 Nov 2010
Location: France
Has thanked: 76 times
Been thanked: 32 times

Re: Fake signal to optimize parameters

Postby Laurent » 07 Feb 2011

Thanks a lot TJ!


Return to “MultiCharts”