protected override void Initialize()
{
Add(anaCurrentDayVWAPV36(anaBandTypeVWAPD36.Variance_Distance, anaSessionTypeVWAPD36.ETH, 1, 2, 3,
anaSessionCountVWAPD36.First));
Add(EMA(20));
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
if (Position.MarketPosition == MarketPosition.Flat
&& CrossBelow(EMA(20), anaCurrentDayVWAPV36(anaBandTypeVWAPD36.Variance_Distance,
anaSessionTypeVWAPD36.ETH, 1, 2, 3, anaSessionCountVWAPD36.First).SessionVWAP, 1)
&& ToTime(Time[0]) > ToTime(15, 00, 0)
&& ToTime(Time[0]) < ToTime(23, 59, 0))
{
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(Cbi.OrderAction.Sell, OrderType.Market, Low[0], 0, TimeInForce.Day, orderId, "VWAPcross", atmStrategyId);
}[INDENT]}[/INDENT]
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Executing too many entries
Collapse
X
-
Executing too many entries
Hi, it seems my strategy is ignoring the market position line in Sim & Replay (not tested Live yet) and is triggering another entry when the CrossBelow event occurs while already short 1 position. Is there something I'm missing here?
Code:Backtesting using a standard entry and profit target/stop loss instead of the ATM strategy works fine. Also, EntriesPerDirection is set to 1. Could it be something to do with CrossBelow or the custom VWAP indicator? ThanksTags: None
-
Hello,
Can you please clarify that you are able to use this AtmStrategyCreate() method when backtesting?
The Atm Strategy methods would not be accessible during backtesting. If you were to run this strategy as is in the strategy analyzer, you would not see the ATM strategy trigger.MatthewNinjaTrader Product Management
-
Sorry, can you please clarify if it runs without issues using the standard entry and profit target/stop loss in Sim and Replay? Or is the issue only one using the ATMStrategyCreate and in Sim?
If you're using the ATM strategy, you should be using GetAtmStrategyMarketPosition() to check this position:
If you see the same behavior, I would suggest running some Print() statements to check your market position under these environments to ensure your position is reported as flat/long/short around this time.MatthewNinjaTrader Product Management
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
646 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
367 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
569 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment