Help with adjusting target orders to stay so many ticks above entire position average - futures io
futures io futures trading



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


Discussion in NinjaTrader

Updated by Luger
    1. trending_up 2,112 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 3 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Thread Tools Search this Thread
 

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

  #1 (permalink)
Market Wizard
Salt Lake City, UT
 
Experience: Intermediate
Platform: NinjaTrader
Broker: NinjaTrader Brokerage
Trading: CL, ES, NQ, YM
 
richw's Avatar
 
Posts: 1,199 since May 2010
Thanks: 948 given, 805 received

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

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 futures io Trade Journal Reply With Quote

Can you help answer these questions
from other members on futures io?
Convert NinjaTrader NT7 indicator to Tradestation EasyLanguage and RADARSCREEN
Platforms and Indicators
Issue meeting order entry conditions
Elite Automated NinjaTrader Trading
Last 5 minutes Label
ThinkOrSwim
Moving average with Lag reduction
NinjaTrader
Linux?
ThinkOrSwim
 
 
  #3 (permalink)
Market Wizard
Salt Lake City, UT
 
Experience: Intermediate
Platform: NinjaTrader
Broker: NinjaTrader Brokerage
Trading: CL, ES, NQ, YM
 
richw's Avatar
 
Posts: 1,199 since May 2010
Thanks: 948 given, 805 received

Oh, and also doing the same thing with the stops...


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

Visit my futures io Trade Journal Reply With Quote
 
  #4 (permalink)
Nashville, TN
 
Experience: Intermediate
Platform: NinjaTrader
Broker: IB
Trading: NQ ES
 
Posts: 468 since Feb 2011
Thanks: 323 given, 543 received

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:



futures io Trading Community Platforms and Indicators NinjaTrader > Help with adjusting target orders to stay so many ticks above entire position average




Upcoming Webinars and Events
 

Free BloodHound Licenses to everyone!

June
 

Every journal equals ten meals for the hungry

June
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts