else if (State == State.Configure)
{
AddVolumetric(Instrument.FullName, BarsPeriodType.Range, Range, VolumetricDeltaType.BidAsk, 1);
AddDataSeries(Instrument.FullName, BarsPeriodType.Tick, 1);
}
if (BarsInProgress == 2)
{
Print("In tick ");
// Update Stop
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
AddDataSeries for "intra" candle backtesting doesn't seem to work
Collapse
X
-
AddDataSeries for "intra" candle backtesting doesn't seem to work
I'm trying to get the intra candle to fill during backtesting to update my stoploss, but it doesn't seem to work. I'm assuming that BarsInProgress == 2 should print, but it doesn't.
Code:Tags: None
-
Does your data provider allow tick data? For example IB and TD don't provide historical tick data.
I build useful software systems for financial markets
Generate automated strategies in NinjaTrader : www.stratgen.io
-
Comment
-
Ok, and I'm assuming your if (BarsInProgress == 2) is in OnBarUpdate? Don't think it works in OnStateChange.Originally posted by tonystarks View PostI downloaded the historical tick data and it shows the tick data in the Historical Data section.
I build useful software systems for financial markets
Generate automated strategies in NinjaTrader : www.stratgen.io
Comment
-
It seems that having AddVolumetric does not work with the second data series. Having two AddDataSeries works, but for some reason having AddVolumetric first does not show anything from the AddDataSeries below it.
Code://This namespace holds Strategies in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Strategies { public class WIP : Strategy { protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Strategy here."; Name = "WIP"; Calculate = Calculate.OnEachTick; EntriesPerDirection = 1; EntryHandling = EntryHandling.AllEntries; IsExitOnSessionCloseStrategy = true; ExitOnSessionCloseSeconds = 30; IsFillLimitOnTouch = false; MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix; OrderFillResolution = OrderFillResolution.Standard; Slippage = 0; StartBehavior = StartBehavior.WaitUntilFlat; TimeInForce = TimeInForce.Gtc; TraceOrders = false; RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose; StopTargetHandling = StopTargetHandling.PerEntryExecution; BarsRequiredToTrade = 20; // Disable this property for performance gains in Strategy Analyzer optimizations // See the Help Guide for additional information IsInstantiatedOnEachOptimizationIteration = true; } else if (State == State.Configure) { // Does not work AddVolumetric(Instrument.FullName, BarsPeriodType.Range, 15, VolumetricDeltaType.BidAsk, 1); AddDataSeries(Instrument.FullName, BarsPeriodType.Tick, 1); // Works //AddDataSeries(BarsPeriodType.Minute, 5); //AddDataSeries(Instrument.FullName, BarsPeriodType.Tick, 100); } } protected override void OnBarUpdate() { if (CurrentBars[2] < BarsRequiredToTrade) return; Print(BarsInProgress); } } }
Comment
-
I found out that using "BarsPeriodType.Tick, 1" doesn't work. It seems that using 2 or more works "BarsPeriodType.Tick, 2".
Comment
-
Hi Tony, If you can pull up a 1 tick chart it should be working properly. If you can pull up a 2 tick chart it means you do have historical tick data with your data feed. Please test by pulling up a 1 tick chart first. Please also let me know what data feed you are using.
Kind regards,
-ChrisL
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
76 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
146 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
79 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
50 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
54 views
0 likes
|
Last Post
|

Comment