NexusFi: Find Your Edge


Home Menu

 





How to cancel an order at a specific time


Discussion in NinjaTrader

Updated
    1. trending_up 2,275 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?
[WTS] ATAS Lifetime ULTRA license – EU buyers only – …
Platforms and Indicators
AI for Traders — Agents, Memory, Tools & Real-Worl …
Elite Quantitative GenAI/LLM
Bitcoin’s 2022 low, 2025 high and 2026 low so far arou …
Cryptocurrency
No book, only a stair: journaling fills where price move …
Cryptocurrency
Building a free browser DOM/SMC simulator - need some ad …
Platforms and Indicators
 
  #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