NexusFi: Find Your Edge


Home Menu

 





Help with adjusting target orders to stay so many ticks above entire position average


Discussion in NinjaTrader

Updated
    1. trending_up 3,180 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

Help with adjusting target orders to stay so many ticks above entire position average

  #1 (permalink)
 
richw's Avatar
 richw 
Salt Lake City, UT
 
Experience: Advanced
Platform: NinjaTrader
Broker: NinjaTrader Brokerage
Trading: CL, ES, NQ, YM
Posts: 1,809 since May 2010
Thanks Given: 2,246
Thanks Received: 1,541

Having found the following code and using it as my guide for learning and developing:



How would one keep the profit target orders adjusted to be so many ticks above or below (whether long or short) the entire position average? I am having trouble finding information on this.

Currently, I am only working on the strategy to take long positions, not short or both, at present.

Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Request for MACD with option to use different MAs for fa …
NinjaTrader
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
58 thanks
Battlestations: Show us your trading desks!
55 thanks
NexusFi site changelog and issues/problem reporting
48 thanks
What percentage per day is possible? [Poll]
31 thanks
GFIs1 1 DAX trade per day journal
29 thanks

  #3 (permalink)
 
richw's Avatar
 richw 
Salt Lake City, UT
 
Experience: Advanced
Platform: NinjaTrader
Broker: NinjaTrader Brokerage
Trading: CL, ES, NQ, YM
Posts: 1,809 since May 2010
Thanks Given: 2,246
Thanks Received: 1,541


keeping them so many ticks away from the entire position average.

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #4 (permalink)
 Luger 
Nashville, TN
 
Experience: Intermediate
Platform: NinjaTrader
Broker: IB
Trading: NQ ES
Posts: 468 since Feb 2011
Thanks Given: 323
Thanks Received: 543

I'm thinking that I would do it in the OnOrderUpdate section.

Suppose you are on your second entry from whatever signal.... In the on order update section have it check for all of your Entry order names and whenever one is filled, have it cancel your prior ExitLimit target and when the cancellation is confirmed place a new one with the new AveragePrice + target amount. Here is a sample of what I am talking about.

 
Code
        private IOrder EntryOrder = null;
        private IOrder Target = null;

        protected override void OnBarUpdate()
        {        
         Condition...
            EntryOrder = EnterLong(...)
        }
        
        protected override void OnOrderUpdate(IOrder order)
        {
            if (EntryOrder != null && EntryOrder == order)
            {
              if (order.OrderState == OrderState.Filled)
                {
                  if (Target != null)
                    {
                     CancelOrder(Target);
                     EntryOrder = null;
                    }
                }    
            }
            if (Target != null && Target == order)    
            {
              if (order.OrderState == OrderState.Cancelled && Position.MarketPosition != MarketPosition.Flat)
                {
                    Target = ExitLongLimit(0, true,CalculationMode.Price, Position.AvgPrice + TickTarget);
                }    
            }
            if (Target != null && Target == order)    
            {
              if (order.OrderState == OrderState.Filled && Position.MarketPosition == MarketPosition.Flat)
                {
                    Target = null;
                }    
            }    
        }

Reply With Quote
The following 2 users say Thank You to Luger for this post:





Last Updated on February 22, 2011


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts