Hi,
I do not understand why OnParamsChange is called at least two times at startup for each indicator.
I can either create objects during the calls, neither can I find textobjects I have created earlier.
Is there any text I can read about the OnParamsChange behaviour?
The attached code, gives the following log print:
...
.2012.10.08 21:35:42 Indicator CCI.dll loaded
.2012.10.08 21:35:42 no timecurrent
.2012.10.08 21:35:42 Timeframe: 1
.2012.10.08 21:35:42 Indicator DemoIndicator.dll loaded
...
.2012.10.08 21:35:43 Indicator zigzag.dll loaded
.2012.10.08 21:35:43 timecurrent 40574.999306
.2012.10.08 21:35:43 Timeframe: 5
.2012.10.08 21:35:43 1.USDJPY OnParamsChange: object markettype not found. (ObjectsTotal: 0)
.2012.10.08 21:35:43 1.USDJPY OnParamsChange: object not created. (ObjectsTotal: 0)
.2012.10.08 21:35:43 timecurrent 41182.999306
.2012.10.08 21:35:43 Timeframe: 15
.2012.10.08 21:35:43 1.EURUSD OnParamsChange: object markettype not found. (ObjectsTotal: 0)
.2012.10.08 21:35:43 1.EURUSD OnParamsChange: object not created. (ObjectsTotal: 0)
.2012.10.08 21:35:43 timecurrent 41182.999306
.2012.10.08 21:35:43 Timeframe: 1440
.2012.10.08 21:35:43 1.EURUSD OnParamsChange: object markettype not found. (ObjectsTotal: 0)
.2012.10.08 21:35:43 1.EURUSD OnParamsChange: object not created. (ObjectsTotal: 0)
All help is appreciated.
OnParamsChange is called many times
-
- Posts: 26
- Joined: Thu Jun 21, 2012 12:03 am
OnParamsChange is called many times
- Attachments
-
- forextester.zip
- (898 Bytes) Downloaded 934 times
Last edited by Robopip on Wed Oct 10, 2012 3:08 pm, edited 1 time in total.
-
- Posts: 905
- Joined: Sat Jul 11, 2009 10:54 am
Hello,
This function is called several times because you placed the indicator on several timeframes so the program will actually create several separate instances of this indicator (the same indicator on different timeframes is treated like separate indicators)
This function is called several times because you placed the indicator on several timeframes so the program will actually create several separate instances of this indicator (the same indicator on different timeframes is treated like separate indicators)
Check our other product here:
http://www.forexcopier.com
http://www.forexcopier.com
-
- Posts: 26
- Joined: Thu Jun 21, 2012 12:03 am
-
- Posts: 905
- Joined: Sat Jul 11, 2009 10:54 am
-
- Posts: 26
- Joined: Thu Jun 21, 2012 12:03 am
FT Support wrote:Probably the indicator is not initialized the access to the chart yet.
What errors do you get when you are trying to create objects from OnParamsChange?
My belif is also that the indicator is not initialized yet. Is there a way to find out that?
I do not know what errors I get. The way I determine if object is created is by watching the return code of ObjectCreate.
If the return code is "true", then object is created otherwise it is not.
Maybe that is the only way to know? i e if ObjectCreate returns "false", it is because the indicator is not yet initialized...
-
- Posts: 905
- Joined: Sat Jul 11, 2009 10:54 am
-
- Posts: 26
- Joined: Thu Jun 21, 2012 12:03 am
I have (so far) difficulties to create objects when Forextester2 is starting up.
I have also noticed that Forextester2 can not create objects during change/install of the indicator. I e if I have changed the source code and want to install the changed indicator, I do get into these situations where the indicator can not create text objects.
I have also noticed that Forextester2 can not create objects during change/install of the indicator. I e if I have changed the source code and want to install the changed indicator, I do get into these situations where the indicator can not create text objects.
-
- Posts: 905
- Joined: Sat Jul 11, 2009 10:54 am
This happens becuase the indicator do not have the access to the chart yet. Please try drawing objects when the indicator is initialized, for example you can draw indicators in "Calculate" procedure, in this case you may need the variable which will tell if the objects were drawn, you can reset this variable in "OnParamsChange".
Check our other product here:
http://www.forexcopier.com
http://www.forexcopier.com
-
- Posts: 103
- Joined: Sun Jan 02, 2011 6:05 pm
Robopip wrote:I have (so far) difficulties to create objects when Forextester2 is starting up.
I have also noticed that Forextester2 can not create objects during change/install of the indicator. I e if I have changed the source code and want to install the changed indicator, I do get into these situations where the indicator can not create text objects.
You are right, OnParamsChange() can only process once during startup and cannot create object.
But you can set flag during startup in OnParamsChange() and ask the Calculate() to process your request to create the object.
Who is online
Users browsing this forum: No registered users and 24 guests