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
Using IOrder in a Strategy
Collapse
X
-
Using IOrder in a Strategy
I have read the information in your help guide regarding IOrder and IPosition. I am still confused as to the exact text to use in the code. WHat I would like to do is Modify the stoploss oder for a specific entry order which I have "tagged" during the entry code.Tags: None
-
clfield,
Welcome to the NinjaTrader Support Forums. What you want to do does not require IOrders. Please check out this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=3222Josh P.NinjaTrader Customer Service
-
I have a strategy that will enter two positions,"Proffit1" which has a fixed stoploss order set in the initialize section and "Proffit2" which I set and modify the stopLoss for in the BarUpdate section.
I want to be able to enter a second set of orders "Proffit3" and Profit"4" before the first set of orders have reached their respective targets. "Profit 3 would have a fixed stoploss set in the initialize secxtion. My problem is in managing the "proffit4" Stoploss order independent of the "Profit 3" Stoploss order.
I have been trying to use the Average entry price to determine my breakeven, however this price is the average of the 4 orders after the 2nd set of orders is placed.
I found the "Client" class in the NT help section and was hoping I could use the AvgFillPrice(string orderId) to get the average price for each descreet entry and the OrderStatus(string orderId) to detemine when the order had been filled. But the help section does not shpw any examples and I am not sure of the exact code needed.
Thanks for you help
Comment
-
clfield,
You should be able to manage each one individually. Please use unique Entry Signal names for each and then you can distinguish which profit target goes with which entry order. To figure out your breakeven for the fourth order you will just need to run your own calculation by hand. If your fourth order has an IOrder attached to it you can access the fill price of that IOrder object. myOrder.AvgFillPrice will do the trick.Josh P.NinjaTrader Customer Service
Comment
-
Please elaborate on myOrder.AvgFillPrice will do the trick. Is this an Iorder Object? I have done a fair amount of programming but this part of it just seems to be a morass. It would be extremely helpful if one could access the state of an order and the average fill price without having to write 400 lines of code.
Comment
-
It is a property of the IOrder object. Please see the Help Guide for more information here: http://www.ninjatrader-support.com/H...V6/IOrder.htmlJosh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Moraha, Today, 03:14 PM
|
0 responses
1 view
0 likes
|
Last Post
by Moraha
Today, 03:14 PM
|
||
Started by DanielSanMartin, Today, 02:37 PM
|
1 response
6 views
0 likes
|
Last Post Today, 02:57 PM | ||
Started by samish18, Today, 08:57 AM
|
7 responses
22 views
0 likes
|
Last Post Today, 02:54 PM | ||
Started by The_Sec, Yesterday, 02:29 PM
|
2 responses
12 views
0 likes
|
Last Post
by The_Sec
Today, 02:30 PM
|
||
Started by love2code2trade, Today, 01:45 PM
|
1 response
11 views
0 likes
|
Last Post Today, 02:10 PM |
Comment