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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
133 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
75 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
117 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
113 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
90 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment