spread = Math.Abs(GetCurrentAsk() - GetCurrentBid());
DrawText("Sell Trig" + CurrentBar, "Sell Trigger: " + Instrument.MasterInstrument.Round2TickSize(sellEntryPrice).ToString(), 1, High[1] + 6 * TickSize, Color.Orange);
DrawText("SPread" + CurrentBar, "Spread: " + Instrument.MasterInstrument.Round2TickSize(spread).ToString(), 1, High[1] + 15 * TickSize, Color.Blue);
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Bid/Ask Spread + CurrentBar
Collapse
X
-
Bid/Ask Spread + CurrentBar
Hey guys, quick question. I entered the codeInto my indicator. and The "Sell Trig" works as always, just fine. shows Trig at every Signal. but the "Spread" always Shows 0. How can I show what the Spread was at Every Signal occurence? regardless of Strategy or signal. I just want the Spread to show on CurrentBars.Code:Tags: None
-
Hello ginx10k,
Here is what i am using:
Output window results $EURUSD as source):Code:if (Historical) return; double spread = Math.Abs((GetCurrentAsk() - GetCurrentBid()) / TickSize); Print ("Spread: "+spread +" ticks: "+Instrument.MasterInstrument.Round2TickSize(spread).ToString());
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 2.000000000002 ticks: 2
Spread: 2.000000000002 ticks: 2
Spread: 2.000000000002 ticks: 2
Spread: 2.000000000002 ticks: 2
Spread: 2.000000000002 ticks: 2
Spread: 2.000000000002 ticks: 2
Spread: 2.000000000002 ticks: 2
Spread: 2.000000000002 ticks: 2
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 2.000000000002 ticks: 2
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Spread: 3.00000000000189 ticks: 3
Comment
-
Hey Paul, I get that also on Output window. but my original post was stating that I want
Meaning I want to see what the Spread was 10 bars ago. 50 bars ago. No matter how far back ago, just on Every Signal occurrence: example: if(EMA(10) > EMA(20) { enterSignal = true; DrawText("SPread" + CurrentBar, "Spread: " + Instrument.MasterInstrument.Round2TickSize(spread) .ToString(), 1, High[1] + 15 * TickSize, Color.Blue);Into my indicator. and The "Sell Trig" works as always, just fine. shows Trig at every Signal. but the "Spread" always Shows 0. How can I show what the Spread was at Every Signal occurence? regardless of Strategy or signal. I just want the Spread to show on CurrentBars.
}
So is it possible to get Historical Spread? that's what I'm after
Comment
-
Hello ginx10k,
You can take the work done with the spread and instead of printing to the output window send it to the chart using DrawTextFixed() method: http://ninjatrader.com/support/helpG...wtextfixed.htm
Comment
-
Here is the reference, with necessary links: http://ninjatrader.com/support/helpG..._ask_serie.htmOriginally posted by ginx10k View PostI don't know how to do that. How can you use bid data series. If it doesn't get stored? I would appreciate if you showed me. Thanks.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
27 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
17 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
9 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
10 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
17 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Comment