--PNF.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Multiple orders at the same direction
Collapse
X
-
Multiple orders at the same direction
Trying to create test strategy using historical data to get multiple order in the same direction, basically "average in" strategy, change setting "Entries per direction" for 100 (do not need, but "in case") and still have only one order executed at the time. Note i'm using 2 time series "long" and "short". "long is decision making, "short" is execution. Yes using if (BarsInProgress == 1) "short" for all entries. Would appreciate some advise, high level pseudo-code, sample, reference point how to accomplish that, so far on my own - no such luck.
--PNF.Tags: None
-
Hello PNF,
Thanks for your post.
Placing multiple orders in the same direction is controlled with the signal names of your strategy, and properties EntryHandling and EntriesPerDirection.
This reference sample can help with scaling in and out of a strategy:
https://ninjatrader.com/suppport/helpGuides/nt8/en-us/scaling_out_of_a_position.htm
This sample can assist further with managing multiple exit/entry signals:
https://ninjatrader.com/support/helpGuides/nt8/en-us/using_multiple_entry_exit_sign.htm
Note that When in historical data, only the Open, High, Low, and Close will be available and there will be no intra-bar data. This means actions cannot happen intra-bar, and fills cannot happen intra-bar. All prices and actions come from and occur when the bar closes as this is all the known information.
Because of this, OnBarUpdate will only update 'On bar close' as it does not have the intra-bar information necessary for 'On price change' or 'On each tick' and the script will not have the intra-bar information to accurately fill an order at the exact price and time.
Please review the help guide document on the differences on real-time vs backtest (historical).
http://ninjatrader.com/support/helpG...ime_vs_bac.htm
Additional information may be found in this NinjaTrader Forum post —
https://ninjatrader.com/support/foru...mance?t=102504
Let us know if we may be of further assistance to you.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
Brandon Hn.,
Thank you for information. I was able to get out the loop i was in. After fix code and run i have 2 more questions.
Please take a look on attached picture, i do not understand why numbers are so different and 2. when i submit limit order and close price is higher than limit, system will be using market order? Appreciate all your help.
--PNF
Comment
-
Hello PageNotFound404,
Thanks for your note.
Please run an optimization using the SampleMACrossOver in the Strategy Analyzer window using the same settings seen in the demonstration video below.
Demonstration video: https://brandonh-ninjatrader.tinytak...NF8yMDYxNDU2Mg
Do you see similar results occurring on your end when testing the SampleMACrossOver strategy as seen in the demonstration video?
I look forward to further assisting.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
-
Hi Brandon H.,
Well i do see see similar numbers, yet not the same ???, which i would have expect.
I do not know what that similar indicates.
How about question #2:
when i submit limit order and close price is higher than limit, system will be using market order?
Instrument Performance Parameters Total net profit Gross profit Gross loss Profit factor Max. drawdown Total # of trades Percent profitable ES 12-22 0.97 6/21 (Fast,Slow) ($3,337.50) $129,887.50 ($133,225.00) 0.97 ($23,900.00) 1734 33.74% 0.97 10/22 (Fast,Slow) ($3,550.00) $124,087.50 ($127,637.50) 0.97 ($24,150.00) 1488 35.48% 0.97 10/25 (Fast,Slow) ($4,075.00) $117,525.00 ($121,600.00) 0.97 ($23,062.50) 1355 33.36% 0.96 6/22 (Fast,Slow) ($4,962.50) $125,625.00 ($130,587.50) 0.96 ($23,750.00) 1680 32.98% 0.95 9/25 (Fast,Slow) ($5,575.00) $118,200.00 ($123,775.00) 0.95 ($22,825.00) 1392 34.12% 0.95 10/24 (Fast,Slow) ($5,875.00) $119,225.00 ($125,100.00) 0.95 ($24,350.00) 1403 33.86% 0.95 6/23 (Fast,Slow) ($6,862.50) $124,575.00 ($131,437.50) 0.95 ($24,037.50) 1631 32.92% 0.94 10/23 (Fast,Slow) ($7,250.00) $120,425.00 ($127,675.00) 0.94 ($25,787.50) 1448 33.84% 0.94 6/25 (Fast,Slow) ($7,525.00) $120,300.00 ($127,825.00) 0.94 ($25,412.50) 1558 33.06% 0.94 8/22 (Fast,Slow) ($8,237.50) $122,762.50 ($131,000.00) 0.94 ($26,762.50) 1549 34.86% Performance All trades Long trades Short trades Total net profit ($3,337.50) $4,925.00 ($8,262.50) Gross profit $129,887.50 $70,137.50 $59,750.00 Gross loss ($133,225.00) ($65,212.50) ($68,012.50) Commission $0.00 $0.00 $0.00 Profit factor 0.97 1.08 0.88 Max. drawdown ($23,900.00) ($11,612.50) ($19,325.00) Sharpe ratio -0.85 0.80 -0.82 Sortino ratio -1.73 81.49 -1.50 Ulcer index 0.07 0.03 0.06 R squared 0.48 0.02 0.70 Probability 59.04% 27.50% 82.62% Start date 11/1/2022 End date 11/30/2022 Total # of trades 1734 867 867 Percent profitable 33.74% 34.37% 33.10% # of winning trades 585 298 287 # of losing trades 1079 531 548 # of even trades 70 38 32 Total slippage 0 0 0 Avg. trade ($1.92) $5.68 ($9.53) Avg. winning trade $222.03 $235.36 $208.19 Avg. losing trade ($123.47) ($122.81) ($124.11) Ratio avg. win / avg. loss 1.80 1.92 1.68 Max. consec. winners 10 5 7 Max. consec. losers 12 12 11 Largest winning trade $3,987.50 $3,987.50 $3,225.00 Largest losing trade ($3,875.00) ($1,450.00) ($3,875.00) Avg. # of trades per day 81.02 40.51 40.51 Avg. time in market 17.03 min 17.48 min 16.58 min Avg. bars in trade 17.02 17.47 16.58 Profit per month ($3,283.67) $4,845.56 ($8,129.23) Max. time to recover 21.04 days 19.65 days 21.04 days Longest flat period 2.20 days 2.21 days 2.21 days Avg. MAE $129.58 $128.85 $130.32 Avg. MFE $199.97 $201.79 $198.15 Avg. ETD $201.90 $196.11 $207.68 Item Value Strategy parameters Fast 6 (5;10;1) Slow 21 (20;25;1) Data Series Start date 11/1/2022 End date 11/30/2022 Price based on Last Type Minute Value 1 Tick Replay False Trading hours Break at EOD True Setup Include commission False Label Sample MA crossover Maximum bars look back 256 Bars required to trade 20 Historical fill processing Order fill resolution Standard (Fastest) Fill limit orders on touch False Slippage 0 Order handling Entries per direction 1 Entry handling All entries Exit on session close True Order properties Set order quantity Strategy Time in force GTC
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by chrischongpdx, Today, 09:39 PM
|
0 responses
7 views
0 likes
|
Last Post Today, 09:39 PM | ||
Started by Mountain_cast, Today, 12:41 PM
|
2 responses
10 views
0 likes
|
Last Post Today, 08:53 PM | ||
Started by dontpanic, 04-07-2015, 04:42 AM
|
4 responses
1,322 views
0 likes
|
Last Post Today, 08:33 PM | ||
Started by algospoke, Today, 07:54 PM
|
0 responses
5 views
0 likes
|
Last Post
by algospoke
Today, 07:54 PM
|
||
Started by Rxxar, Today, 06:26 PM
|
0 responses
10 views
0 likes
|
Last Post
by Rxxar
Today, 06:26 PM
|
Comment