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 charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
65 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
149 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
162 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
99 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
286 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment