NexusFi: Find Your Edge


Home Menu

 





How to cancel an order at a specific time


Discussion in NinjaTrader

Updated
    1. trending_up 2,043 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?
Irans Dual Probability: Guns Quiet at 99.95% While Forma …
Prediction Markets & Event Contracts
TradingView Opens Volume Footprint Data to Pine Script - …
TradingView
The May 31 Binary: 60% Trump Declares Iran Ops Over, Onl …
Prediction Markets & Event Contracts
Energy Futures Shatter All-Time Daily Volume: 8.3 Millio …
Commodities
The Ceasefire Curve: 2pct Peace by Next Week, 60pct by S …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 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