Friday 11 November 2016

Add Button to Chart Toolbar - NinjaTrader 8

NinjaTrader Educational Resourses details an Indicator / script that adds a button with a background image to the toolbar of the chart window. These buttons can be useful to trigger custom blocks of code in NinjaTrader 8 Indicators and Strategies.

The original script can be found on the NinjaTrader 8 Support Forum
using_bitmapimage_objects_with_buttons.htm

demoToolBarButton.cs 
For demonstration, this NinjaTrader 8 Indicator loads a button (but excludes the bitmap) and assigns a Click event. This event simply toggles the printing of the Instrument Name and Description on to the chart.

This is a convenient solution to add custom button functionality to a NinjaTrader 8 Chart. (without the need to impliment WPF)



NinjaTrader 8 - Demo Tool Bar Button
Download the NinjaScript code 
demoToolBarButton.cs





Friday 4 November 2016

Display Chart Instrument/Symbol Name in Large Letters - NinjaTrader 8

Append this NinjaScript Draw.TextFixed function to the code block:




Instrument Name Label. 6S (Swiss Franc Futures) 



Adjust the font, size, colors and alignment parameters as required. Use this line of NinjaScript code in any NinjaTrader 8 Indicator or Strategy.

NinjaScript > Language Reference > Common > Drawing
Draw.TextFixed : https://ninjatrader.com/support/helpGuides/nt8/en-us/?draw_textfixed.htm


Instrument.MasterInstrument.Name returns the Instrument Name 6S property as shown above

There are a number of other properties in the namespace Instrument.MasterInstrument including:
Instrument.MasterInstrument.Currency, Description and InstrumentType.

NinjaScript > Language Reference ...
Instrument.MasterInstrument : https://ninjatrader.com/support/helpGuides/nt8/en-us/?masterinstrument.htm

Monday 5 September 2016

NinjaTrader 8 - How to change the skin colors

A new installation of NinjaTrader 8 has the "Slate Gray" skin set by default.

1) Open NinjaTrader 8. From the Toolbar

Click on: Tools > Options



2) In the "General" Category

Goto: General > Properties > Preference > Skin
Select a skin type from the dropdown list.
Click OK



3) Restart Required

Click OK



4) Start NinjaTrader 8

Start NinjaTrader to see the skin change take effect. This is the "Light" Skin.




Thursday 25 February 2016

DeltaBars Indicator for NinjaTrader 7

What is Volume Delta?
Volume delta is the difference between the total of the bid and ask traded volume.

What is the DeltaBars Indicator?
The DeltaBars Indicator for NinjaTrader 7 takes the delta value and modifies the bar color accordingly. Positive DeltaBars are printed in blue and negative DeltaBars are printed in red; Delta values for each bar are printed alongside. Cumulative volume delta values for Bid/Ask (red/blue) and Total (black) are plotted at the footer of the chart.



How it is calculated?
Positive Delta
The ES S&P emini traded 200 contacts at the offer and 100 contracts traded at the bid, this means that there is a "positive delta" of 100 hundred contracts. Delta Value: 200 (positive)

Negative Delta
The ES S&P emini traded 100 contacts at the offer and 200 contracts traded at the bid, this means that there is a "negative delta" of 100 hundred contracts. Delta Value: -100

This "Delta Value" is calculated as either a positive or negative value. This value can then be displayed on each bar; and depending if the delta is positive or negative, then modifiying the bar color accordingly.

What are DeltaBars good for?
The resulting graphical representation of this data could be useful in deturmining the bias of the order flow at that moment. Be aware that an "up bar", (one which closes higer than it opened and usually represented in green) would in fact be displayed in red should there be a negative delta. An up bar displayed in blue for example means that the delta is positive and the price move was in accordance with the order flow.

User Configurable Parameters: 


Notes:
* Pressing F5 will refresh the chart and ALL the delta values.
* DeltaBars does not consume historical volume data. Only data from a live datafeed will be processed and printed on screen.
* This indicator works on any time period.

Installing this indicator:
1) Download the indicator from the link below.
    (Note: on Google Docs page, click the Download Icon - Top Center)
2) Save the zip file to a convenient location on your PC.
3) In the NinjaTrader 7 Control Center, click File >> Utilities >> Import NinjaScript...
4) Select the zip file, and import it in to NinjaTrader. 

Download / Indicator Info

    FileName: A1DeltaBars.zip << Download Link
    Version: 1.0.0
    Type: NinjaTrader 7 Indicator
    Copyright: N.Martin (c) Feb 2016
    Website: http://nigel-forex.blogspot.co.uk/
   
    -- Version 1.0.0
    * Create Dictionary Look up for: barBidVolume, barAskVolume,
       totalBidVolume, totalAskVolume, totalVolume.
    * Change Bar Colors based on delta value
    * Print Delta Value per bar
    * Print Cumulative Volume for Bid, Ask and Total
  
    -- Version 1.0.1 Proposed
    * The Delta value printed on each bar needs to be text centered.

Friday 19 February 2016

NinjaTrader 7 - Volume Profile - Modified Volume Zones Indicator

"Volume Zones" is a default indicator included with NinjaTrader 7 and is used to analyse and display volume data as a "profile".

This indicator only displays volume bars for the price bars that are on the chart, meaning you can quicky rescale or scroll the chart, to show volume profile for a specific time period on the chart; and most importantly the ability to handle historic and incoming volume data.

My only issue with this indicator is that it is left aligned. In order for me to utilise this indicator, i needed to see the profile displayed on the right hand side of the chart; and further to that, the actual volume bars are too "low resolution"


Changes
After making a few tweaks to the code, the volume profile is now plotted on the right hand side of the chart and the resolution is increased from 20 to 60 rows. To enable easier identification of high and low volume nodes, i also added a black line profile


The white background and black outline of the profile "spikes" make it easier to identify the HVNs and LVNs. (compared to the blue version below)


I am providing this script in its "beta" form and for educational purposes only - "as is" with no warranty. I may continue to improve this script and release further versions in future.

Download / Indicator Info

    FileName: A1VolumeProfile.cs
    Version: 1.0
    Type: NinjaTrader 7 Indicator
    Copyright: N.Martin (c) Feb 2016
    Website: http://nigel-forex.blogspot.co.uk/

    File Download URL:
    https://drive.google.com/file/d/0BzwRDK7g5KnfODE0VlZERWN1VlE/view?usp=sharing

    -- Version 1.00
    * Plot volume profile on the right hand side of the chart
    * Increased the resolution from 20 to 60. To enable easier identification of high and low nodes,
    * Added Black profile outline - has minor bug where last plot data point 'falls off the screen'
   
    -- Version 1.1 Proposed
    Plot horizontal lines on high and low volume nodes.
    ShowHVN true | false
    ShowLVN true | false
    HVNcolor [color]
    LVNcolor [color]
    NumVolNodes int    

    Increase the "resolution" to allow for one volume bar per pip.  
    Provide option to plot micro composite volume profiles on each session.   
    Provide option to plot user defined micro composite volume profiles

FX-PriceBoard - MT5 Indicator



In a previous post FX-PriceBoard - MT4 Indicator I created an indicator that would display an up todate overview of the markets as a price board. There was some interest in this indicator, however i believe that the "licence" i wrote in to the software expired some years ago.

So, to keep up with the times, I am currently re-writing the "FX-PriceBoard for MetaTrader 5"  this will provide the same features as before, including the addition where the price comparison is based up the current charts timeframe. Also, with the advent of wider PC monitors, the FX-PriceBoard has been adapted to display each Currency Group in it own column, giving a sleeker appearance than before.

For example, if you are looking at the M5 chart, then the strength and weakness of a specific currency group is based on the whether the current price is above or below the previous 5 minute periods price.

FX-PriceBoard is not intended as a "Trading System" and is an indicaor only, however, for example, by observing the short term H1 vs longer term D1 strength / weakness could help to gauge the overall bias of particular currency groups.

The following screenshot shows the GBPAUD H1. The Price Board shows clears strength in the AUD group and some weakness in the GBP group. Taking note that the base currency for this chart is GBP ie GBPAUD it is possible that there could be a downturn in price once again, inline with the trend and moving averages.



Other Asset Groups
Although this indicator is call FX-PriceBoard, a number of brokers who provide MT5 include Indices and Futures prices with their data feeds, i am intending to incorporate that data as well, alternatively an "Auto" option would be preferable, where the MT5 platform is queried for available symbols and then the data is rendered in to the appropriate groups.

Release Date and Availability
This is currently a work in progress, I am targeting for mid 2016 to release this. 
I am intending to release FX-PriceBoard indicator via the MetaQuote market place at
https://www.mql5.com/en/market/mt5

Interested in this Indicator?
Thanks to those who have shown an interest in the FX-PriceBoard for MT4 version, I do not have any immediate plans to re-release this indicator at this time, however, if this MT5 version is popular then i shall look at re-releasing MT4 again.

If you have any suggestions for features to be included in this Price Board, then please comment below; or ping me an email maxdecimus88 at gmail com and i will update you once there are any updates / release dates.


Ideas For User Options, Features and Improvements


 To add to this list

* Display: Price | Price Change Pips | Price Change %

* Text color selection
* Text size selection
* Text font selection
* Color Scheme: Yellow on Black | Yellow on Green | Black on White   

* AutoDisplaySize - Render the priceboard based on the chart height and width, giving a "responsive design" Then it may be suitable for 50" Flat Screens? |

Thoughts
I have detailed some ideas below, however, upon reflection, i think the Price Board would be best doing just that - Displaying Prices / Changes. The Volume and strength meter mentioned below maybe best saved for another indicator.

Volume / Depth of Market / Order Book
Dependent on the Volume, Depth of Market and Time&Sales data available from MT5, It may be possible to provide options to display the "Price Board" info based on: Price or Volume / Order Book data.

Strength Meter / Value
An over all strength could be displayed at the footer of each currency group column. However additional pairs would have to included in each list to ensure the weighting is correct for each group. For example, Comparing the USD group to the CHF group at this time would inaccurate as there are 8 currency pairs listed for USD and only 1 for CHF. To ensure correct weigting and comparison, all group would have to contain their equal and opposite pair; (and this may only lend itself to the majors)  I have created other currency strength indicators before that take this in to account.

more updates to follow...

Sunday 2 August 2015

Cannot ping MetaTrader Trading Server - ping n/a

The Problem 
Having come across the dreaded "n/a" when attempting to ping a trading server; I found myself getting somewhat frustrated to say the least that i could not connect.

I had set up a fresh instance of an Amazon AWS Windows 2012 Server to use as a VPS. I then proceeded to install a fresh copy of MetaTrader 5 from MIG Bank / Swiss Quotes. The installation was complete and i was ready to use an existing demo account to login with.

Thats when the problems started. I clicked File > Login to trading account. And the terminal was just hanging, with the dreaded n/a shown in the ping column. This is a problem i saw ages ago with MetaTrader 4. In my wisdom, i thought i'd simply create a new demo account from File > Open an Account

Knowing the "Open an Account" dialog would allow me to (force) ping the sever in question, thus getting me back on track - Wrong! I was faced with the same issue again - n/a - aggghhhh !

Having ensured the firewall was allowing the MetaTrader application access to the network i was again left wondering why on earth i could not connect. Using the default server name i thought i'd be clever and enter that same address in to the field "Add a new broker like 'BrokerName' or address mt.company.com:443" - This achieved the same result - nothing.

More head scratching followed; and with that niggling feeling that a port was being blocked. I checked the settings in the AWS console. In particular "EC2 Dashboard" > "Security Groups" and selected the web server security group that i had previously setup. This was allowing http on port 80 both incoming and outgoing, all good, what now?

The Solution
Thats when a moment of clarity hit me that the trading server wants to "talk" over port 443... ah ha. So i proceeded to setup a "custom tcp rule" (in AWS console > EC2 > Security Groups) and specified port 443 for incoming and outgoing traffic.

Upon returning to MetaTrader 5, i again clicked File > Open an Account and sure enough the dialog showed the ping at 45.49ms which then allowed me to proceed with setting up an account.

I know metaquotes have browsed my blog before, so if you are reading this, then maybe another "if else" is required in the code to trap if the MetaTrader application cannot connect via port 443?
That'd be quite useful.

Aparently "The answer to the ultimate question of life, the universe and everything is 42" - In this case it the answer was port 443 ! 

Anyway, i hope this info may help others stuck in the same position.

Provider Info:
Amazon AWS - https://aws.amazon.com/ec2/
MetaQuotes MetaTrader 5 - http://www.metaquotes.net/
Broker: MIG Bank / Swiss Quotes  - http://www.swissquote.ch