Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
how to enter open[0]+10 in a variable?
Collapse
X
-
how to enter open[0]+10 in a variable?
Hello. My programming knowledge is small. I would appreciate some guidance. I have a button that launches an order at Open[0]+10 ticks. When a new bar is created the order is moved. I know that for it not to move I should include the Open[0]+10 ticks in a variable and place that variable in EnterLongStopLimit((Open[0] + (18 * TickSize)) , (Open[0] + (18 * TickSize )) , "l"); but I am not able to include the Open[0]+10 ticks in a variable. Could you help me a little? thank you.Tags: None
-
Do you mean you want to store the open only at the open of the day, or at the open of each bar?
If you mean the open of each bar, it would be like:
double MyOpenValue = Open[0];
EnterLongStopLimit(MyOpenValue + 10 * TickSize, "EntryOrderNameHere");
If you mean the open of each day, and it's a 24-hour chart, you would need to check for the first bar that is after the open and only store it on that bar.
- Likes 1
-
Hello julifro,
To make the order not move you need to store the price you want to a variable at a specific point, for example when you first enter. That variable can be used for the orders price so when you re submit it the same price is being used each time you call the order method again. It would only move if you later update that variables price before the order fills.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
139 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