Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
HFT ATM Strategy Generating Unwanted Positions
Collapse
X
-
HFT ATM Strategy Generating Unwanted Positions
I've created a strategy that monitors level 2 data to generate trades. It is using an ATM Strategy Template to manage the trade exits. For the most part, it is working as expected. However, in fast markets it is generating multiple positions. Are there any recommended methods of handling this?Tags: None
-
Hello SystemTrading, thanks for your post.
First, you would need to use Print methods throughout the code to see if anything is getting hit twice where it is not supposed to. To prevent duplicates and multiple positions, it will boil down to the code being used and how it's designed. It could be a simple bool variable that prevents blocks of code running for more than one bar e.g.
You are also using a try/catch in OnMarketData which could be suppressing an unknown error or order handling problem, try printing the Exception or remove the try catch and see if any errors come up.Code:bool trade = true; if(Conditions To Trade && trade) { EnterLong(); trade = false; } if(Conditinos to Exit && !trade) { ExitLong(); trade = true; }
Please let me know if I can assist any further.
-
Hi SystemTrading,Originally posted by SystemTrading View PostI've created a strategy that monitors level 2 data to generate trades. It is using an ATM Strategy Template to manage the trade exits. For the most part, it is working as expected. However, in fast markets it is generating multiple positions. Are there any recommended methods of handling this?
Nice work.
From just a quick read of the code...
If "HFT" in the name means you are trading from fast charts then I would not be surprised to see these of these if() statements sometimes fail.
Code:if (atmLong.Position==MarketPosition.Flat) if (_buySignal && !buySignal) if (atmShort.Position==MarketPosition.Flat) if (_sellSignal && !sellSignal)
When might if (atmLong.Position==MarketPosition.Flat) fail?When executing orders at speed on fast charts I would not be surprised to find that the (order risk approval > order execution > (broker <> NT8 sync process) is not always fast enough to ensure being sync with your actual market position prior to the next event update and "if (ATMStrategyId.Length==0)" will produce an inaccurate result.
When might buySignal fail?I saw the bools Chris was referring to (buySignal, sellSignal) and at first glance it looks like they would protect you from double entries. However, if the total for _buySignal is 1.3 during event updates following a _buySignal > 1.5 signal that might potentially reset the entry protection bool buySignal too early ( buySignal = _buySignal; ).
Best of Luck!
HedgePlayLast edited by hedgeplay; 02-25-2021, 10:53 AM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
41 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
124 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
64 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
41 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment