SmartQuant Discussion
http://www.smartquant.com/forums/

Specify Instrument for an indicator
http://www.smartquant.com/forums/viewtopic.php?f=60&t=10675
Page 1 of 1

Author:  azuric [ Fri Feb 07, 2014 12:52 pm ]
Post subject:  Specify Instrument for an indicator

How do I specify which instrument an indicator should be built on?

Author:  Dr. Anton Fokin [ Fri Feb 07, 2014 12:57 pm ]
Post subject:  Re: Specify Instrument for an indicator

Hi,

you attach indicator to a time series, but not directly to an instrument. Could you tell us what you are trying to achieve?

Regards,
Anton

Author:  azuric [ Mon Feb 10, 2014 5:39 pm ]
Post subject:  Re: Specify Instrument for an indicator

Hi, I am analysing one market (instrument1) and trading in another (instrument2). So I only want to run an indicator on instrument1 not both.

Even if it must calculate an indicator for both instruments, which is inefficient but I can live with, I am unsure how to reference the indicator for instrument1 only.

Regards

Author:  Dr. Anton Fokin [ Tue Feb 11, 2014 9:33 am ]
Post subject:  Re: Specify Instrument for an indicator

Hi,

something like this?

public static Instrument indicator_instrument;
public static Instrument trade_instrument;

OnStrategyStart()
{
indicator_instrument = Instruments["MSFT"];
trade_instrument = Instruments["AAPL"];

if (instrument == indicator_instrument)
// create indicator
}

OnBar()
{
if (Instrument == indicator_instrument)
// check entry condition
}

Regards,
Anton

Author:  azuric [ Tue Feb 11, 2014 10:19 am ]
Post subject:  Re: Specify Instrument for an indicator

Hi Anton, will try that.

BTW does that mean OnStrategyStart is instrument specific somewhat similar to OnBar.

Regards

Author:  Dr. Anton Fokin [ Tue Feb 11, 2014 10:47 am ]
Post subject:  Re: Specify Instrument for an indicator

Yes, it's called for every instrument.

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/