NexusFi: Find Your Edge


Home Menu

 





How to cancel an order at a specific time


Discussion in NinjaTrader

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




 
Search this Thread

How to cancel an order at a specific time

  #1 (permalink)
 sburtt 
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: EUR/USD
Posts: 58 since Jul 2012
Thanks Given: 3
Thanks Received: 4

Hi Guys,

I have a problem with NT7. I am running a multi time frame strategy using 60 minutes as primary time frame to generate trading signals (BarsArray[0]) and using 1 minute as secondary time frame to execute orders. I would like my limit order to be valid only until 1 minute to the end of the primary time frame. I was thinking this order could of worked, but it is not, it's returning a compiling error, could anybody tell me what I am doing wrong?

 
Code
primarytimeFrame = 60;
secondaryTimeFrame = 1;

if(BarsInProgress == 1)
{	
	if (longCondition == true)
		{
			entryOrderLong = EnterLongLimit(1, true, 1, Low[0],"Long");
		}
//Cancel long order if not done within 1 minute to the end of primary time frame if(ToTime(Times[1][0] == Times[0][0].AddMinutes(primaryTimeFrame-1)) && entryOrderLong != null) { CancelOrder(entryOrderLong); }
}
I get an error message that says:
 
Code
Cannot implicitly convert type "System.DateTime" to " double"
Strategy.Base.ToDate(System.DateTime) has some invalid arguments

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
33 thanks
Just another trading journal: PA, Wyckoff & Trends
28 thanks
Tao te Trade: way of the WLD
23 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #3 (permalink)
kandlekid
College Point, NY (Queens)
 
Posts: 63 since Nov 2009
Thanks Given: 5
Thanks Received: 20


To me it looks like you're giving ToTime a boolean rather than a DateTime. But that doesn't seem to be reflected in the error message, so maybe I'm wrong

Reply With Quote
  #4 (permalink)
 sburtt 
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: EUR/USD
Posts: 58 since Jul 2012
Thanks Given: 3
Thanks Received: 4


kandlekid View Post
To me it looks like you're giving ToTime a boolean rather than a DateTime. But that doesn't seem to be reflected in the error message, so maybe I'm wrong

your right the code "seems" to work fine without ToTime

Started this thread Reply With Quote




Last Updated on August 15, 2013


© 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