|
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.
Getting the current period in OnStart() |
[fyer12]
|
Post subject: Getting the current period in OnStart() |
Post rating: 0
|
Posted: Sat 13 Nov, 2010, 14:34
|
|
User rating: 0
Joined: Wed 10 Nov, 2010, 00:56 Posts: 16
|
How can i get the current period in the onStart function?
context.getPeriod() does not work when attaching an indicator to a chart. I think it only works when an indicator is called from an another one or a strategy.
My problem is I am using multiple period inputs in my indicator:
InputParameterInfo m1_input = new InputParameterInfo("Input data", InputParameterInfo.Type.BAR); InputParameterInfo m5_input = new InputParameterInfo("Input data", InputParameterInfo.Type.BAR); m1_input.setInstrument(Instrument.EURUSD); m5_input.setInstrument(Instrument.EURUSD); m1_input.setPeriod(Period.ONE_MIN); m5_input.setPeriod(Period.FIVE_MINS); inputParameterInfos = new InputParameterInfo[] {m1_input, m5_input};
Now the problem is if one switches from M1 to M5 or higher the chart stops working (just like e.g. the Pivot indicator that comes with jforex, start it with period M5 and then switch higher -> chart dead). So i want to fetch the current period and only set input streams which are greater than the current one.
Thanks
|
|
|
|
 |
API Support
|
Post subject: Re: Getting the current period in OnStart() |
Post rating: 0
|
Posted: Tue 16 Nov, 2010, 10:30
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Hi, Method onStart is called upong attaching an indicator to chart. You can use an optional parameter to specify the current chart period and then set the period of your input parameters accordingly.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|