if (CurrentBar < BarsRequiredToTrade) {
return;
}
double Highest = MAX (High, 10) [1];
double Lowest = MIN (Low, 10) [1];
if (High[0] > Highest) {
EnterLong ("long");
}
if (Low[0] < Lowest) {
EnterShort ("short");
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Trying to enter a trade after price exceeds the highest high after 10 ticks.
Collapse
X
-
Trying to enter a trade after price exceeds the highest high after 10 ticks.
Like my headline says, I am trying to enter a trade after the price exceeds the highest high from the past 10 ticks but I don't know if my code is actually doing it. Looking at this code, am I accomplishing what I need to?
Code: -
Hello jertrade,
Thanks for your post.
It will be necessary to use prints to verify that the logic you have written is doing what you expect. For example, you would print out values used to evaluate your conditions, like "Highest" to see that it is giving the value you are looking for, and that the logic is updating as you expect it to.
double Highest = MAX (High, 10) [1]; This code is checking the highest high of the last 10 bars, from 1 bar ago. If you are running against a single tick data series, this would mean the highest high of the last 10 ticks, from the previous tick.
If you are trying to check if the highest high of the last 10 bars is exceeded, you could use MAX (High, 10) [0]; and if you want to see if this happens after X number of ticks, you could add a single tick data series, and use that single tick data series to increment an integer to count how many ticks have passed. Then you could trigger logic "after 10 ticks."
Please see our Multi Time Frame and Instruments documentation for a complete walkthrough for creating multi series NinjaScripts.
Multi Time Frame and Instruments - https://ninjatrader.com/support/help...nstruments.htm
Please let us know if we can be of further assistance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
56 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
132 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
73 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
49 views
0 likes
|
Last Post
|

Comment