Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Entry Offset
Collapse
X
-
Entry Offset
Is it possible to program a NinjaScript strategy to enter with a specified offset as can be done with the SuperDom?Tags: None
-
can you give me a clue? This is what I have:
// Condition set 1
if (GVsLynnDeesCriteria().Plot0[0] > 0.5)
{
EnterLong();
}
// Condition set 2
if (GVsLynnDeesCriteria().Plot1[0] > 0.5)
{
EnterShort();
}
Comment
-
I'm using range bars. The way the current code works is it enters the trade at the close value of the trigger bar + 1 tick for buy orders and - one tick for sell orders. I want the order to be placed at the close price. This is done in the SuperDom by entering to buy at the close price + 0.25 with an offset 0f -1 and entering to sell at the close price - 0.25 with an offset of -1.
Comment
-
I can't get this to work. I'm still working with range bars and trying to emulate manual trading with the SuperDom where I buy at the close of the trigger bar + 0.25 with an offset of -1. The order gets placed at the close of the trigger bar price.
I've tried things like:
EnterLongStopLimit(Close[0] - TickSize, Close[0]);
Nothing works.
Comment
-
I'm not sure I exactly follow what 'does not work' as you would expect - are you getting any errors or is it not placing the order you would expect in your scenario? In backtesting orders would be placed for the next bar after the condition the triggered...please post the code you used and clarify you would expect it to achieve. Thanks
Comment
-
I'm trying to buy at the close price of the trigger bar, emulating how I would buy manually using the SuperDom. This is the code. I really don't understand this. Get error: Stop limit generatated error "Order Rejected"
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Triggers a buy when Lynn Dees buy criteria are met
/// Triggers a sell when Lynn Dees sel criteria are met
/// </summary>
[Description("Triggers a buy when Lynn Dees buy criteria are met, a sell when sell criteria are met")]
public class GVsToPost : Strategy
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
SetStopLoss(CalculationMode.Ticks, 9);
SetProfitTarget(CalculationMode.Ticks, 8);
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (GVsLynnDeesCriteria().Plot0[0] > 0.5)
{
EnterLongStopLimit(Close[0] + TickSize, Close[0]);
}
// Condition set 2
//if (GVsLynnDeesCriteria().Plot1[0] > 0.5)
{
//EnterShort();
}
}
#region Properties
#endregion
}
}Last edited by jerryvellutini; 11-18-2009, 06:26 AM.
Comment
-
I thought I replied but I don't see it.
The error says:
Buy stop or buy stop limit orders can't ne placed below the market.
Affected Order: Buy 1 StopLimit @ 1105.25x1105.5
The close of the trigger bar was at 1105.25
Comment
-
My problem is I'm trying to automate what I do all day manually using the SuperDom. I thought this was the right command but obviously not. Can you tell me how you would do it?
Thanks
Comment
-
Jerry,
You should not be able to place stop-limit orders with the stop price below the market price even in the DOM. You need to check in your code for valid submission prices. If you go Close[0] + TickSize it is possible in fast markets for the market to move up and make that price you submitted an invalid price below the market. You should not be placing orders so close to the market as this can occur.Josh P.NinjaTrader Customer Service
Comment
-
I've been ringing this out with a test case using the Market Replay Connection. If I execute this order manually using the SuperDom it works. The log says Buy
Limit Price = 1105.25
Stop Price = 1105.50
Clearly the Limit Price is less than the Stop Price.
I've used this methodology on hundreds of trades and trust me - it works.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
660 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
375 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
110 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
579 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment