NeoTicker Indicator JukeBox

C# discussion

Moderator: moderators

achau
rank: <50 posts
rank: <50 posts
Posts: 4
Joined: Mon Apr 16, 2007 12:10 am
Reputation: 0
Gender: None specified

Postby achau » Sat Aug 04, 2007 6:01 pm

Hi Michal,

I had created something a similar framework using a singleton static class and I put the arraylist of instances with uniqueid in the static class. However, I encountered problem using the following situation:

I have two indicators; let say indicator 1 and indicator 2. Both of them are dlls written in c#. indicator 1 will invoke another chart window using the OLE automation and the chart window contains indicator 2. Under this situation, the indicator 2 cannot see the singleton static class created in indicator 1 and it call the constructor again to construct another singleton static class. I would like to know if your framework can resolve this issue.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

achau
rank: <50 posts
rank: <50 posts
Posts: 4
Joined: Mon Apr 16, 2007 12:10 am
Reputation: 0
Gender: None specified

Postby achau » Sun Aug 05, 2007 3:52 am

I tried to migrate to this framework. It seems that Indicator2 still cannot see the JukeBox created in Indicator1.

BTW, I had created indicator1 and indicator2 in the same dll but use diffeernt entry point class. Any suggestions to overcome this challenge.

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Postby michal.kreslik » Sun Aug 05, 2007 4:23 pm

Achau,

the Jukebox is meant to facilitate multiple application of the same indicator.

Do I understand you correctly that you need two completely independent indicators that would have access to one shared object? And this object would be accessible from all instances of these two indicators?

Michal

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Postby michal.kreslik » Sun Aug 05, 2007 5:09 pm

I'm attaching the new and improved version of the NTIndicatorJukeBox. There's an error handling added and a RemoveCall() and StandardCall() are being strictly separated.

Also, as a convenience, I'm attaching the IDL Indicator Template that makes it easy to start a new project in Visual Studio with the NTIndicatorJukeBox.

Inside the zippped archive, the Template Project folder contains the source template project. The Template folder contains the Visual studio template itself that can be imported to Visual Studio directly:



The resulting new project, created from this project template also contains the file IDLIndicatorTemplate.idl. It's a template for the accompanying IDL file. You just need to rename this file directly in Visual Studio to whatever is the name of your IDL indicator (don't forget to leave the extension as is - ".IDL"), change the project type from the default Debug to Release and hit Compile (F6). The .IDL file will automatically be copied over to the /indicator folder under NeoTicker.

Have fun! :)

Michal
Attachments
JukeBox_and_IDL_template.zip
(402.99 KiB) Downloaded 80 times

achau
rank: <50 posts
rank: <50 posts
Posts: 4
Joined: Mon Apr 16, 2007 12:10 am
Reputation: 0
Gender: None specified

Postby achau » Sun Aug 05, 2007 10:50 pm

Michal,

Your understanding is correct. I need Indicator 1 and indicator 2 to work on different timeframe of data. Indicator 1 use eod data while indicator 2 use tick data to do other analysis. Indicator 1 and 2 need to talk to each other. What I intended to do is like this:

Function window 1, Indicator 1 - Get the EOD data

| Invoke Indicator 2 on a new function window using OLE automation
V

Function window 2, Indicator 2 - Work on the tick data in the new function window

| Indicator2 completed, returned to function window 1 and indicator 1
V

Indicator 1 works on the result of Indicator2


I understand that the framework intended for the same indicator. Hence, I tried to package indicator 1 and 2 into a same dll. In fact, I just further modify Indicator 1 and 2 and put them together now. They are now the same dll with the same entry point. I use a paramater in the indicator to indicate whether it is indicator 1 or indicator 2 and then jump to the correct routine. The behavor is very strange now. The debugger cannot stop in indicator 2. I suspect all the issues are related to the OLE automation. If I manully start function window 2, things work fine. I probably need to change the program archtecture completely.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

igorzomb
rank: <50 posts
rank: <50 posts
Posts: 2
Joined: Wed Jan 23, 2008 4:05 pm
Reputation: 0
Gender: Male

destructor function for Jukebox

Postby igorzomb » Fri Feb 01, 2008 6:41 pm

Hi Michal,

Love the idea of Jukebox. It's simple and elegant to use the unique indicator identifier and allow one to have their own indicator objects without worrying about heap issues.

How about taking this one step further and calling some "destructor function" after the last bar of the indicator has been completed.

Once the indicator object is called this one last time, it will never be called again...

Igor

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Re: destructor function for Jukebox

Postby michal.kreslik » Mon Feb 04, 2008 11:06 am

igorzomb wrote:Hi Michal,

Love the idea of Jukebox. It's simple and elegant to use the unique indicator identifier and allow one to have their own indicator objects without worrying about heap issues.

How about taking this one step further and calling some "destructor function" after the last bar of the indicator has been completed.

Once the indicator object is called this one last time, it will never be called again...

Igor


Hi, Igor,

if the indicator is applied to a real time chart, it will be called on every new incoming tick (or on a timer call, if you set the indicator to be a timer). So you can't finalize the individual indicator objects after the last bar has been reached. There can be furhter "last bars" :)

Michal

igorzomb
rank: <50 posts
rank: <50 posts
Posts: 2
Joined: Wed Jan 23, 2008 4:05 pm
Reputation: 0
Gender: Male

Re: destructor function for Jukebox

Postby igorzomb » Mon Feb 04, 2008 3:10 pm

How about just adding a "stubbed out" function OnLastBar() which will be called when (Data1.get_BarsNum(0) == Data1.LastBarsnum). This way, the person writing his own indicator could decide if he may want to do something "special" when this condition is reached.

For non-realtime indicators, one may use this technique to "flush out" whatever has been saved in memory. For realtime indicators, one may or may not want to do anything...

Igor

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “C# coding for NeoTicker”