NexusFi: Find Your Edge


Home Menu

 





How to cancel an order at a specific time


Discussion in NinjaTrader

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




 
Search this Thread
  #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?
Pakistan Mediator in Tehran as Hormuz Normalization Coll …
Prediction Markets & Event Contracts
US Prop Firms Race Inside the CFTC Perimeter -- Tradeify …
Funded Trading Evaluation Firms
$500M Riding on World Cup 2026: France/Spain Co-Favored …
Prediction Markets & Event Contracts
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
Penalties in Budapest, Peace Deadline in Tehran: Arsenal …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
13 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 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


© 2026 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 - Downloads - Top
no new posts