Go Back   NinjaTrader Support Forum > NinjaScript File Sharing > NinjaScript File Sharing Discussion

NinjaScript File Sharing Discussion Discussion for shared NinjaScript files.

NinjaTrader
Reply
 
Thread Tools Display Modes
Old 12-02-2009, 11:07 AM   #1
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 376
Thanks: 4
Thanked 38 times in 18 posts
Default All GomRecorder Indicators

Hi,

For convenience purposes I've decided to move all GomRecorder indicator binaries to here.

Reminder: GomRecorder indicators are developped using the GomRecorderIndicator framework and allow developers to access an emulated OnMarketData() on historical bars.

This is done using a file that records ticks.


Here's 1.0 version ; package contains
  • GomRecorderIndicator
  • GomVWAP
  • GomVolumeProfile
  • GomCD
  • GomCDSMA
  • GomCDHA
  • GomDeltaVolume
I'll document the indicators in this thread

Package is compatible with 6.5 and 7B5.

Feel free to contribute !

EDIT : Added GomFileConverter

EDIT : version 1.2 contains
  • GomRecorderIndicator
  • GomDeltaIndicator
  • GomVWAP
  • GomVolumeProfile
  • GomCD
  • GomCDMA
  • GomCDHA
  • GomDeltaVolume
  • GomDeltaMomentum
EDIT : 1.2 nuked, please use 1.3

EDIT : 1.3b restores NT7 functionnality for GOMCDHA and GOMCDMA

EDIT : THIS VERSION IS OBSOLETE PLEASE GET VERSION 2.1 HERE
http://www.bigmiketrading.com/elite-...order-2-a.html
Attached Images
File Type: png gompackage1.2.png (77.4 KB, 2891 views)
Attached Files
File Type: zip GomDeltaBarsType1.0.zip (2.0 KB, 2177 views)
File Type: zip GomFileConverter1.1.zip (13.6 KB, 1349 views)
File Type: zip GomPackage1.1.zip (27.2 KB, 1401 views)
File Type: zip GomPackage1.3b.zip (31.3 KB, 3566 views)
Last edited by gomifromparis; 11-29-2010 at 07:57 AM.
gomifromparis is offline  
Reply With Quote
The following 13 users say thank you to gomifromparis for this post:
Old 12-02-2009, 11:08 AM   #2
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 376
Thanks: 4
Thanked 38 times in 18 posts
Default

GomRecorderIndicator : the base indicator.

The purpose of this indicator is to allow the use of a pseudo OnMarketData on historical data.
To achieve this, a file containing ticks is recorded and reread during historical bar construction.

WARNING : on opening of the file, GomRecorded checks what is the last date recorded, and it will only record data after this date. So "backfill" using replay files is not possible.

File formats :
  • There are 3, which are, from more verbose to less verbose : Flat, Short and Binary.
  • Flat format is the only really human-readable format.
  • You can convert from one format to another using the file converter (more on this later)
  • DateTimes are recorded using UTC time zone, allowing to share files between users
File contents :


The file contains the ticks with time, volume, and a value to representing where the tick happened in the current bid/ask context.

The algorithm is :
Code:
 
if (ask<bid) // should not happen but does
{ 
     if (price<ask)       tickType=TickTypeEnum.BelowBid;
     else if (price==ask)  tickType=TickTypeEnum.AtAsk;
     else if (price<bid)  tickType=TickTypeEnum.BetweenBidAsk;
     else if (price==bid)  tickType=TickTypeEnum.AtBid;
     else      tickType=TickTypeEnum.AboveAsk;
}
else if (bid<ask) //normal case
{
     if (price<bid)       tickType=TickTypeEnum.BelowBid;
     else if (price==bid) tickType=TickTypeEnum.AtBid;
     else if (price<ask)     tickType=TickTypeEnum.BetweenBidAsk;
     else if (price==ask)  tickType=TickTypeEnum.AtAsk;
     else     tickType=TickTypeEnum.AboveAsk;
}
else //bid==ask, should not happen
{
     if (price<bid)      tickType=TickTypeEnum.BelowBid;
     else if (price>ask)     tickType=TickTypeEnum.AboveAsk;
     else        tickType=tickType=TickTypeEnum.BetweenBidAsk;
}
Time recording:
  • Time granularity is the second.
  • If "compress ticks" is set, all ticks occuring at the same second and with the same ticktype are aggregated on one tick with the sum of all aggregated ticks volume.
  • This makes the file smaller but ruins the ability to do volume filtering on the indicators


File location and naming :
  • Files are stored in My Documents folder, unless you set the GOMFOLDER environment variable, which will be used then.
  • Files are named Instrumentname.FileFormat.txt or .dat

Time filtering :
  • When Time filtering is on, the recorder doesn't send tick to the indicator outside of session hours.
  • If it is off, all ticks are use, so in all the AH ticks are sent to the first bar of the session.

Writing flag :
  • Only one of the Recorder derived indicators per instrument is allowed to write in the file. You must indicate which one it is by setting the write flag to true.
  • If the indicator is unable to gain write access, "Recording KO" is showed. Usually typing F5 solves the case and a "Recording OK" should appear.
  • The RecorderIndicator shouln't need to be instantiated on a chart, except as a "recording-only" indicator.
Smoothing of Volume and Tick charts
  • As the file has a 1 second resolution, there can be a problem on bars that are less than a second long. This can easily happen : for instance, bars that have their volume split by NT are 0 second long.
  • The recorder will try to split volume and ticks on constant volume and tick charts, so that all volume is not sent on only one bar.
How do I create a GomRecorder Indicator :

see GomVWAP for an example.
  • Basically you must derive your indicator from GomRecorderIndicator instead of Indicator.
  • Then you must use methods GomInitialize(), GomOnBarUpdate() and GomOnMarketData(TickTypeEnum tickType,double price,int volume) instead of standard NT methods, and you're done.
  • If you need to access the exact time of the tick that is sent, you can use GomOnMarketDataWithTime(DateTime tickTime, TickTypeEnum tickType,double price,int volume,bool firstTickOfBar)
  • All indicators will inheritate all the GomRecorder properties.
GomVWAP
  • Simple example of GomRecorder indicator.
  • VWAP is reset on the start of a new session.
GomVolumeProfile
  • This indicator is a GomRecorder modded version of the NT VolumeProfile.
  • If Reinit session is set to true, the values are reset on each session break.
  • You can instantiate one indicator with Reinit Session set to true, and another indicator with Reinit Session set to false with different colors, and in that way you can see both full chart volume and daily volume on the same chart.
Last edited by gomifromparis; 12-06-2009 at 02:33 PM.
gomifromparis is offline  
Reply With Quote
The following user says thank you to gomifromparis for this post:
Old 12-02-2009, 11:08 AM   #3
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 376
Thanks: 4
Thanked 38 times in 18 posts
Default

GomCD (Cumulative Delta)

This indicator is used to plot Delta (volume signed +/- depending if is considered buying volume(+) or selling volume(-).

The data is plotted in the same format than the main price data : Candlesticks, OHLC and HiLo are supported.

Calculation Mode
  • BidAsk : if (tick >= ask) the volume is buying ; if (tick <= bid) the volume is selling
  • UpDownTick : if (tick > previous tick) volume is buying ; if (tick < previous) tick volume is selling
  • UpDownTickWithConinuation : if (tick > previous tick) volume is buying and any further volume@tick is buying ; if (tick < previous)tick volume is selling and any further volume@tick is selling
Delta Calculation
  • CumulativeChart : Delta values are summed bar after bar
  • NonCumulativeChart : Delta is reset on the beginning of each bar.
Reinit on session break
  • Delta is set to 0 on the beginning of a new session.
  • A Zero Line will be drawn
Size Filter Mode
  • None: all ticks are used
  • OnlyLargerThan : only ticks with volume strictly larger than Volume Filter Size will be used
  • OnlySmallerThan : only ticks with volume strictly smaller than Volume Filter Size will be used.
  • Size filtering requires that tick compression is disabled.
Bid/Ask Backup mode
  • If the GomCD is incomplete, you can complete it with some NT extracted data with the file converter.
  • This data doesn't contain bid/ask info, but you can tell the GomCD thas if no Bid/Ask info is available, it must fallback to using UpDownTick or UpDownTickWithContinuation.
CandleSticks : Enhance HiLo Bars

This setting doubles the size of the HiLo bar of the candlestick when in candlestick mode.


CandleSticks : Show Outline

Enables or disables the drawing of the candlestick outline when in candlestick mode


Force HiLo for non cumulative

When in non cumulative mode, forces the GomCD format to HiLo to avoid drawing glitches.


Forced HiLo Bar size

When in forced HiLo mode, determines the width of the bars.


Paint Type
<U>
  • </U>Determines the color of GomCD bars
  • None : All bars painted with bar outline color
  • UpDown : if (Close > Open) Color is UpColor ; if (Close < Open) Color is DownColor
  • StrongUpDown : if (Close > High[1]) Color is UpColor ; else if (Close < Low[1]) Color is DownColor ; else Color is bar outline color
Exposed Dataseries

The GomCD exposes 5 DataSeries for use in other indicators : DeltaClose, DeltaOpen, DeltaHigh, DeltaLow, DeltaValue(=DeltaClose)



GomCDSMA
  • This is an example of how to use the GomCD values in other indicators : here it is an SMA using the GomCD DeltaClose time series.
  • The SMA can be overlayed over a CD chart

GomCDHA (Heikin Ashi)
  • This code is an adaptation from ModHA indicator.
  • It's used to plot a Heinkin Ashi version of GomCD
Last edited by gomifromparis; 12-02-2009 at 12:13 PM.
gomifromparis is offline  
Reply With Quote
Old 12-02-2009, 11:09 AM   #4
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 376
Thanks: 4
Thanked 38 times in 18 posts
Default

GomDeltaVolume

This indicator is another representation of the delta. It is not cumulative.


Delta Mode

  • True : Shows Abs(Buying Volume - Selling Volume). Resulting bar is green or red depending on Sign(Buying Volume - Selling Volume)
  • False : Shows Buying and Selling volume seperatly, with positive green bars and negative red bars


Show total volume :

If True, shows total volume of the bar as a blue bar. Mostly useless if Delta Mode is False.



GomDeltaBarType

This indicator will create a new Bar Type (Volume, Time , Range etc) called GomDelta that will construct bars at a constant delta.

Of course you can't calculate the bid/ask delta in the historical bar construction since bid/ask is not available, so UpDownTickWithContinuation model is used as a proxy.

Compatible with 6.5 and 7b5
Attached Images
File Type: png gomdeltabartype.png (60.1 KB, 1663 views)
Last edited by gomifromparis; 12-15-2009 at 05:03 PM.
gomifromparis is offline  
Reply With Quote
Old 12-02-2009, 11:09 AM   #5
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 376
Thanks: 4
Thanked 38 times in 18 posts
Default

GomFileConvert

Purpose of this stand alone app is to convert data to GomRecorder format.
It requires the 3.5 Framwork because it uses some Time Zone conversion classes.

Possible uses include:

  • Converting Binary data to Flat for editing purposes
  • Converting Flat to Binary for size purposes
  • Converting NT, IRT and QCollector files to GomRecorder format for backfill purposes.


Input File Format :

Flat, Short, Binary :

Those are GomRecorder Files


Ninja :

Allows converting Ninja export format to GomRecorder format. Bid/Ask won't be available, obviously, but you can use UpTick option in GomCD as a fallback


IRT :

Investor R/T format


Collector :

Qcollector format. I use this weekly to get a clean file using Qcollector.

Then I add it to the previous week file using binary add in Windows :
copy /bin file1.dat+file2.dat file3.dat


Format is DateTime;Price;Volume;Bid;Ask and looks like this :
30/11/2009 22:30:26;1093;3;;
30/11/2009 22:30:26;;;0;1093
30/11/2009 22:30:27;;;1092,75;0


Input File Culture, InputFile TZ :

Use this if you're converting data that comes from a computer in another country


Compress tick :


Activates tick compression. Don't use if you're planning to do volume size filtering, as some ticks will be aggregated.


Tick size:

Needed for short and binary format as prices aren't recorded as floats but as a number of ticks.
Attached Images
File Type: png gomfileconverter.png (7.9 KB, 674 views)
Last edited by gomifromparis; 12-06-2009 at 02:48 PM.
gomifromparis is offline  
Reply With Quote
The following user says thank you to gomifromparis for this post:
Old 12-02-2009, 11:43 PM   #6
aviat72
Senior Member
 
Join Date: Jul 2009
Location: San Francisco Bay Area
Posts: 216
Thanks: 0
Thanked 5 times in 4 posts
Default Recording KO when using multiple indicators on same instrument.

I have multiple charts which use the GOMRecorder based indicators. All of them have recording set to false. All of them show Recording OFF status.

I have a dedicated chart which I use for recording the ticks. All this has the instrument with a range chart (which needs tick data) and the GomRecorderIndicator. This one shows KO and repeated reload NJ (F5) do not help.

Quote:
Unfortunately I do not have the debugger installed on this particular machine so can not tell you where, but I think I have a guess. However they still open the file to read it on initialization. I think Windows gives exclusive ownership rights and once a file is opened, even if it is for a read, it will not allow anything else to takeover ownership to write to the file.
I have confirmed in a debugger that in the GOMRecordIndicator lines 250-256 fails to open the file for writing.

Code:
{
 try 
    { 
                            datafilewrite=File.Open(FileName,FileMode.Append,FileAccess.Write,FileShare.Read);
writeOK = true;
     }catch (Exception) { writeOK=false; }
 }
Workaround:

I have created a new workspace which is dedicated to saving data. I load that workspace first. Before closing NT, I close all the other workspaces and keep this one active. When NT restarts it opens the recorder workspace first which seems to work fine i terms of not KO the recording. I am not sure that the other indicators will continue to work properly on recorded data (i.e. can they read the data file while it is still being written).
Last edited by aviat72; 12-03-2009 at 12:00 AM.
aviat72 is offline  
Reply With Quote
Old 12-03-2009, 03:12 AM   #7
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 376
Thanks: 4
Thanked 38 times in 18 posts
Default

The only reason your recording indicator shouldn't be able to gain write access to the file would be that another indicator or process has the write access. The reading indicators don't interfere.

Please check all indicators, there must be one somwhere with Write=True.
gomifromparis is offline  
Reply With Quote
Old 12-03-2009, 04:22 AM   #8
rt-trader
Senior Member
 
Join Date: Jan 2007
Location: , ,
Posts: 274
Thanks: 4
Thanked 7 times in 4 posts
Default

Gomi,

You are a Legend... thankyou for sharing your excellent and comprehensive work....
rt-trader is offline  
Reply With Quote
Old 12-03-2009, 04:43 AM   #9
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 10,084
Thanks: 2
Thanked 32 times in 25 posts
Default

FYI: Editing indicators in the file sharing section now should work again as expected.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 12-03-2009, 11:21 AM   #10
aviat72
Senior Member
 
Join Date: Jul 2009
Location: San Francisco Bay Area
Posts: 216
Thanks: 0
Thanked 5 times in 4 posts
Default

Quote:
Originally Posted by gomifromparis View Post
The only reason your recording indicator shouldn't be able to gain write access to the file would be that another indicator or process has the write access. The reading indicators don't interfere.

Please check all indicators, there must be one somwhere with Write=True.
I have tried various configurations and it was unable to open for write when there were no other indicators writing. All of the charts are templated with recording OFF. I also recreated the scenario on the machine with a debugger (almost a virgin setup with just a few charts), so I am > 95% sure of what was happening.

The database files were all zero byte files since they had just been created by the non-recording indicators. I am not sure whether that makes a difference.

I am not a Windows expert so do not know how the file-system handle these situations when you have multiple clients reading from a file which is also being written? How is the integrity of the file pointers maintained as file continues to change?
aviat72 is offline  
Reply With Quote
Old 12-03-2009, 11:37 AM   #11
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 376
Thanks: 4
Thanked 38 times in 18 posts
Default

That's strange... Never seen that... Concerning concurrent file access, there is really no problem to have 1 writer/plenty readers.
gomifromparis is offline  
Reply With Quote
Old 12-04-2009, 02:12 AM   #12
TheRightSide
Junior Member
 
Join Date: Sep 2008
Posts: 17
Thanks: 0
Thanked 0 times in 0 posts
Default

Installed the Gomi Package today and gave it a try. Just brilliant stuff! You are a very generous person to share your work with others. Thank you.

Can I throw in a feature request if I may, would you be able to provide an option to anchor the Volume Profile to right or left rather than just the current fixed to left axis.
Last edited by TheRightSide; 12-04-2009 at 02:28 AM. Reason: poor grammer
TheRightSide is offline  
Reply With Quote
Old 12-04-2009, 02:00 PM   #13
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 376
Thanks: 4
Thanked 38 times in 18 posts
Default

I only took the original NT code an wrapped some Gom methods around to make it GomRecorder compliant. So do some changes would require to actually analyse how it works, and I have little time for that.
Sorry
gomifromparis is offline  
Reply With Quote
Old 12-05-2009, 07:32 PM   #14
superarrow
Senior Member
 
Join Date: Dec 2007
Posts: 128
Thanks: 0
Thanked 0 times in 0 posts
Default

Gomi,
I downloaded the latest package but in both 6.5 & 7 CD fails to retrieve prior intraday values. It displays the current day values but always starts at 0. Got the 'reinit' status to false. I have only one instance of the 'write' recorder status to true, and format is binary.

One more thing, is it possible to limit the lookback days in the VolumeProfile?

Thanks for the great and generous work.

Cheers,
SA
superarrow is offline  
Reply With Quote
Old 12-06-2009, 05:29 AM   #15
gomifromparis
Senior Member
 
Join Date: Oct 2007
Posts: 376
Thanks: 4
Thanked 38 times in 18 posts
Default

Try disabling the time filter to seen if it has anything to do with it
gomifromparis is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Eotprolive indicators + have free access to there Trading Room / Indicators johncare Platform Technical Support 0 08-27-2009 03:03 AM
Custom Indicators calling other Custom Indicators DancesWithBears Indicator Development 6 08-21-2009 12:19 PM
Charting indicators using other indicators as the input Elliott Wave Platform Technical Support 3 04-04-2008 03:54 PM


All times are GMT -6. The time now is 01:55 AM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content.