Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hi,
I am using Limit OR market orders for entry and have used SetStopLoss and SetProfitTarget for exits.
If I understand correctly, SetProfitTarget is a limit order.
When the price is trading on my target for exit, based on few conditions I would like to convert limit order to market order.
Do I need to change the order using SetProfitTarget (CalculationMode.Price, GetCurrentBid() + TickSize) to cover long position and SetProfitTarget (CalculationMode.Price, GetCurrentAsk() - TickSize) to cover Short position?
I like to use OCO orders as my target and exits are predefined based on entry.
Thanks,
GSREDDY.
Can you help answer these questions from other members on NexusFi?
Great question, I could never figure out how to "unset" a PT with NT7. I would away move it way out of range so I didn't end up with an overfill if I threw a Market Order to exit.
Hi
Thanks for the reply and great work on LOM.
I am using SetProfitTarget to exit and trying to modify the same order to get it filled(modifying it to below or above current bid or ask price). Not issuing any new Exit orders to exit.
if we modify the SetProfitTarget values, it should update/modify the existing order in the market if it is not yet filled. If the order get filled before it gets updated with new price, my OCO order will get cancelled because of filled leg and the reference to change of price will be lost.
Can you please provide me the case where we get over fill with OCO (Market entry, exits with SetProfitTarget and SetStopLoss?
Can you please point me to any document or any thread related to more information on over filling related SetProfitTarget?
Thanks,
GSREDDY.
hi,
Thanks for the help and suggestions. If I make the below changes to the existing OCO order resting in the exchange should not over fill theoretically. I haven’t coded for this yet, I am still in the design and learning phase. If anyone has used this method for filling please through some light on any issues faced.
I have also discussed this in ninja form. OCO to [AUTOLINK]Market Order[/AUTOLINK] - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum
sequence of steps.
1. Use the SET methods to set profit target and stop loss
2. Enter the position in OnMarketData based on the flags set in on bar update
3. Once the position is filled exchange will have working initial profit target and stop orders
4. Based on few conditions verified in OnBarUpdate, need to set the flags to move profit target or close the position at market
5. Case1: once the conditions are met to increase PT without closing position
• In OnExecution check for any fill or partial fill @ initial PT
• If there is no fill call the setptofittraget with new price. This will change the PT to new price
• If the position gets filled before updating the price in exchange, order(new change) will get rejected
Case2: conditions are met to close the existing position @ market
• In OnExecution check for any fill or partial fill @ initial PT and collet order status and PT price into variables
• If the order is not completely filled use the set profit target method to move the PT way far from market (may be 20 ticks)
• In OnOrderUpdate check for change in the order status and price comparing the data collected in the above steps and issue the market order to close the position.
6. If the position is flat and there is no working orders in the exchange, rest the initial profit and stop loss to initial values
As per the information got from ninjaform, we don’t need to cancel the pending PT and stop loss orders in the exchange. Ninja should cancel these orders once the position goes to flat.
Can you please point me if I am missing anything in this design that needs to be taken care?
Are there any drawdowns in this approach? I really need second look in this design since this is the first time I am trying to do something in this area of scripting.
Thanks
gsreddy