Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
EnterLong above a specific value or price.
Collapse
X
-
EnterLong above a specific value or price.
I have written a strategy in C# where I want to submit a long order above a specific price, what function do I use? For example, current stock price is $100 and it is within a range from $102 and $97. I want to submit a long order if the price break above $102. How do I put this conditional order using C#? What function do I use?Tags: None
-
Hello Bhavin81,
For that type of condition you would check if the close price is greater equal to 102 or you can also use CrossAbove as the condition. A specific price can be entered as Misc -> Numeric value.
If you wanted the strategy to know about the102 price without typing it in you would need to determine what relevance 102 has so that can be calculated. However you are generating the range of prices would be what you need to look into further to understand if that can be made into a variable or calculated by the strategy.
-
I am bit confused. I created a new custom strategy which is called "SubmitConditionalLongAbove". This strategy I guess will have to take Two input; TriggerPrice and Quantity. I already have a strategy called "MarketForecastStrategy", which determines when to go long above a given price. So, in this case, MarketForecastStrategy will call "SubmitConditionalLongAbove" strategy and pass TriggerPrice and Quantity. SubmitConditionalLongAbove will then call EnterLongLimit function in OnBarUpdate() method as below? Is that right understanding? if so, How do i make sure that this strategy/conditionalOrder only executes ones and may be in given timelimit?
protected override void OnBarUpdate()
{
//Add your custom strategy logic here.
if (CurrentBar <= BarsRequiredToTrade)
return;
if(Close[0] > EntryPrice)
{
EnterLongLimit(Quantity, EntryPrice, "MR Forecast Long" + CurrentBar);
}
}Last edited by Bhavin81; 02-11-2023, 04:16 PM.
Comment
-
Hello Bhavin81,
For this type of use case with a Limit order you would need to make sure your condition stays true for as long as the order is not filled. Limit orders expire after 1 bar if not filled unless you keep calling the entry method while it should be active.
You could add a simple position check here as part of the condition, if the position is flat and close is above entry price then allow the entry. Once the entry fills and the position is not flat it wont be called again.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
62 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
134 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment