[FONT=Courier New][SIZE=2][COLOR=#0000ff]#region[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Using declarations
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] System;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] System.ComponentModel;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] System.Diagnostics;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] System.Drawing;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] System.Drawing.Drawing2D;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] System.Xml.Serialization;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] NinjaTrader.Cbi;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] NinjaTrader.Data;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] NinjaTrader.Indicator;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] NinjaTrader.Gui.Chart;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] NinjaTrader.Strategy;
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]#endregion
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000]// This namespace holds all strategies and is required. Do not change it.
[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]namespace[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] NinjaTrader.Strategy
{
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]<summary>
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000] Enter the description of your strategy here
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]</summary>
[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][Description([/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"Enter the description of your strategy here"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2])]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]class[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] ArbBuyOMD : Strategy
{
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]#region[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Variables
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000]// Wizard generated variables
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000]// User defined variables (add any user defined variables below)
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] ForexSymbol = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"$USDCAD"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2];
[/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]#endregion
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]<summary>
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000] This method is used to configure the strategy and is called once before any strategy method is called.
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]</summary>
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Initialize()
{
CalculateOnBarClose = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2];
EntriesPerDirection = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2];
EntryHandling = EntryHandling.UniqueEntries;
Add(ForexSymbol, PeriodType.Minute, [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] );
TraceOrders = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2];
}
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]<summary>
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000] Called on each bar update event (incoming tick)
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]</summary>
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] OnBarUpdate()
{
}
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]<summary>
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000] Called on each bar update event (incoming tick)
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]///[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#808080]</summary>
[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][/FONT][FONT=Courier New][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] OnMarketDepth(MarketDepthEventArgs e)
{
Print([/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"success"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]);
}
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]#region[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] Properties
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]#endregion
[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]}
}
[/SIZE][/FONT]
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
OnMarketDepth()
Collapse
X
-
OnMarketDepth()
I am trying to use the OnMarketDepth() method however I am not having success. Can anyone tell me why this would not work? Also, is the OMD() method supposed to trigger for changes in every instrument I am watching?
Code:Tags: None
-
-
That is definately what I wanted. Thanks again Josh!!!
BTW is there a list of all the methods available in Ninja?
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
62 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
33 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
44 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
58 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
47 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment