![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Dec 2008
Posts: 338
Thanks: 0
Thanked 0 times in 0 posts
|
I changed my strategy to have EnterLongLimit() instead of LongLimit() as I was displeased on the entry prices I was seeing. It looks like I am not using it correctly, or misunderstanding its use.
if ((iOrderL1 == null || Historical) && iQuantity1 != 0) iOrderL1 = EnterLongLimit(0, true, iQuantity1, Close[0], sENTRY1L); Shouldnt the above wait until cancelled for a fill at the Close price from the trigger bar, ie the last bar that closed on BarsArray[0] ?? First attempt today on MBTrading demo gives a fill at same slippage as a strategy running with code that is EnterLong() Screen attached of the limit order fill TJ |
|
|
|
|
|
#2 | |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi TJ,
Quote:
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Dec 2008
Posts: 338
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Ryan!
The screens shows the realtime ("First attempt today on MBTrading demo ") test. COBC=true. The OR Historical was part of the design from the certified Ninja consultant that helped with the strategy. The same strategy is used for backtesting and realtime. There is no "if (Historical)' type of code in the strategy so I am thinking this "OR" is a different way of doing the same idea. Thanks, TJ
Last edited by Trader.Jon; 02-09-2011 at 01:57 PM.
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Close[0] should be the close price of the signal bar. Can you send in your log / trace files and we can see exactly how this order was submitted. Use Help > Mail to support feature with Attn:RyanM in subject. Let us know as well the time that these orders were placed.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Dec 2008
Posts: 338
Thanks: 0
Thanked 0 times in 0 posts
|
Email sent
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Thanks, Jon.
The orders are all submitted at 1.3731 2/9/2011 1:26:50 PM|1|32|Order='6afbc757dffc41f1bac491632b6e548f/Sim101' Name='e1L' New state=PendingSubmit Instrument='$EURUSD' Action=Buy Limit price=1.3731 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' Is this a multiseries script? Possibly getting the Close[0] value from another series? Did you reload historical data at all? I would monitor this and start printing the Close[0] value so you can verify it's what you expect. Let us know if this is something you can reproduce every time with the strategy.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Dec 2008
Posts: 338
Thanks: 0
Thanked 0 times in 0 posts
|
Ryan,
There was no reloading of historical data unless that happens when you load a strategy on a chart: and there were several bars on the chart prior to the signal being generated as it is set 'wait until flat' to enter a trade. ![]() I will monitor. I am concerned that you think that the Close[0] is from another time frame I am using ... can/should I use Closes[0][0] for the EnterLongLimit() instead ?? Would that resolve the MTF potential issue 100% ?? Please clarify, for the Print of Close ... if (BarsInProgress == 0) Print("BA0 Bar closes"+Closes[0][0]); // and so on for each BarsArray? Thanks, Jon
Last edited by Trader.Jon; 02-09-2011 at 08:59 PM.
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Dec 2008
Posts: 338
Thanks: 0
Thanked 0 times in 0 posts
|
Ryan,
I used two different machines, with a different data source on each (MBTrading and Dukascopy), and modified the strategy to give me more trades, with same strategies on each machine. All testing in SIM from 3am today $EURUSD, default NT Range bars and also Better Renko. The strategy uses 3 Bars Array(0,1,2) for a mix of Range and Better Renko. The LongLimit entry is the same as earlier posted in this thread. Using just eyeballs, bottom line is that Close[0] as the limit entry price on my MTF strategy has slippage almost 100% of the time (up to 8 ticks!) based on the entry from the close of the trigger bar COBC=true && BarsArray==0. Use of Closes[0][0] as limit price in the same code had minimal if any slippage. This behaviour was seen on both NT Range bars and also the custom Better Renko bars. ![]() If you would like the logs and Print Output let me know asap, but I am guessing you can duplicate similar behaviour. I suggest changes in the help documentation if you find my observations to be consistent with yours, even if this is 'behavior as expected'. Regards, Jon
Last edited by Trader.Jon; 02-10-2011 at 08:46 AM.
|
|
|
|
|
|
#9 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi Jon,
Yes, multiple time frames could definitely contribute. If you don't exclude other BIP from the calculation then it will use the last updated Close. You may consider capturing the value you want in a variable within BIP 0 if (BarsInProgress == 0) myLimitPrice = Close[0]; Additional information on this is available at the following link > True Event Driven OnBarUpdate() Method http://www.ninjatrader.com/support/h...nstruments.htm
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Dec 2008
Posts: 338
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Ryan,
I think I will stay with the Closes[0][0] as the limit price unless you know of a drawback to its use in this scenario. I am trying to keep the code as clean as possible. Regards, Jon |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| EnterLongLimit and BackTest | simone | Strategy Development | 1 | 09-09-2010 02:30 PM |
| EnterLongLimit() | ltemme | Automated Trading | 17 | 04-15-2010 04:56 PM |
| EnterLongLimit | zooinek | Indicator Development | 3 | 05-21-2009 03:58 AM |
| help on EnterLongLimit | toyogo00 | Strategy Development | 1 | 07-21-2008 09:46 AM |
| EnterLongLimit order | mike8943 | Strategy Development | 3 | 07-04-2008 01:47 PM |