Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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.
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.Chris L.NinjaTrader Customer Service
-
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 aussugardefender, Today, 01:07 AM
|
0 responses
3 views
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
238 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
383 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
||
Started by oviejo, Today, 12:28 AM
|
0 responses
4 views
0 likes
|
Last Post
by oviejo
Today, 12:28 AM
|
||
Started by pechtri, 06-22-2023, 02:31 AM
|
10 responses
125 views
0 likes
|
Last Post Today, 12:03 AM |
Comment