Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
strategy limit order - stop chasing the candles
Collapse
X
-
strategy limit order - stop chasing the candles
Hi, I know I've seen the answer in here somewhere, but can't find it. How do i tell the strategy to stop moving the limit order up as candles close higher above it?Tags: None
-
if ((Close[0] > Open[0])
&& (Close[1] > Open[1]))
{
EnterLongLimit(Convert.ToInt32(DefaultQuantity), Median[0], "");
}
i'm sure it just keeps checking for 2 consecutive green candles if I'm flat, and then placing a new limit each time if the limit doesn't get hit, so i guess I'm wondering how to tell it to stop checking once the initial limit order is placed
Comment
-
Hello,
Thank you for your reply.
You could certainly use a bool. For example, if you make a bool called OrderPlaced, and set that to false, check that it's false before entering the order, then flipping the bool to true, you could then monitor in OnOrderUpdate for the order to be filled or cancelled and flip the bool back to false when that occurs to keep the order from firing again. Keep in mind that with limit orders the default behavior is to cancel the order once the conditions for entry are no longer true, so it'll get cancelled once the current and prior bar are no longer rising bars. If you want the order to stay live until cancelled, you can do that. Here's an example from our help guide on how to keep an order alive:
Please let us know if we may be of further assistance to you.Kate W.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by burtoninlondon, Today, 10:13 AM
|
1 response
12 views
0 likes
|
Last Post Today, 10:52 AM | ||
Started by ezrollin, 02-26-2022, 11:14 PM
|
11 responses
217 views
0 likes
|
Last Post
by kenz987
Today, 10:43 AM
|
||
Started by Ticks_66, Today, 09:50 AM
|
1 response
5 views
0 likes
|
Last Post Today, 10:32 AM | ||
Started by Aquila_Welokk, 04-29-2024, 01:14 PM
|
1 response
20 views
0 likes
|
Last Post Today, 10:18 AM | ||
Decrease the size of the RegionHIghLightY on each tick when the price touches it
by cmtjoancolmenero
Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
|
3 responses
22 views
0 likes
|
Last Post Today, 10:16 AM |
Comment