![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Feb 2007
Location: Germany
Posts: 37
Thanks: 1
Thanked 0 times in 0 posts
|
Hello!
To enter Long positions with Limit orders using Quantity, Price and Signal Name I can use the following order Code:
EnterLongLimit(int quantity, double price, string signalName); Code:
ExitLongLimit(int quantity, double limitPrice, string SignalName); Code:
ExitLongLimit(int quantity, double limitPrice, string SignalName, string fromEntrySignal); Code:
ExitLongLimit(int quantity, double limitPrice, string fromEntrySignal); My strategy creates lots of orders. For debugging purpose I need to identify which ExitLongLimit order was executed in a spefic situation. When I take a look at the Order Page all ExitLongLimit orders are identified as "sell" orders. Any ideas? Is there a possibility to customize the order type overloads? thx |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Why can't you use?
ExitLongLimit(int quantity, double limitPrice, string SignalName, string fromEntrySignal); When fromEntrySignal is the signal you provided in EnterLongLimit() ? Ray
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Feb 2007
Location: Germany
Posts: 37
Thanks: 1
Thanked 0 times in 0 posts
|
Because I cannot be sure which entry signal created the current situation / the current amount of shares.
Depending on the current situation different market entry ordersare created with a variable number of shares. Let's say if the market is above a yesterdays close+x buy 10 "buy_in_high", if it is in between close+10 and close-10 buy 3 "buy_in_mid" and if it is below close-10 buy 1 "buy_in_low". Then I buy an sell at certain levels ("buy_one_at_z", "sell_one_at_y", ... etc.). So a ExitLongLimit order could exit one shares of the position I initially bought to enter the market, or it could exitone shares Iadded later. |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
I see.
Try this, I believe it should work: ExitLongLimit(quantity, limitPrice, "MyExitName", string.empty); Ray
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Feb 2007
Location: Germany
Posts: 37
Thanks: 1
Thanked 0 times in 0 posts
|
That works perfect, thanks for the tip.
Nathamus PS: You have to write empty with capital E, otherwise it won't compile. Code:
ExitLongLimit(quantity, limitPrice, "MyExitName", string.Empty); |
|
|
|
|
|
#6 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
You correct, thanks for pointing it out.
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|