Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Intrabar Signal Analysis - Single Output When True
Collapse
X
-
Intrabar Signal Analysis - Single Output When True
Hi, I have a question regarding evaluating a signal intrabar but preventing that signal from re-outputting a true signal (if this makes sense?). Currently I am calculating OnPriceChange and would prefer to keep the OnPriceChange evaluation method but would like it signal only one time. I.e. using OnPriceChange -> if xxx is true, output. When price changes xxx is evaluated again but if true again, do nothing. Any chance there's an example or method of something like this?Tags: None
-
Hello itsthefriz,
Thank you for your note.
To clarify, you want the signal to be generated once per bar, intrabar using OnPriceChange to calculate, is that correct?
You could create a bool variable and call it something like SignalGenerated. Within your condition block that triggers the signal, check that SignalGenerated is false before actually generating the signal, and if it's false, set SignalGenerated to true, and output your signal. Then, reset the signal on the first tick of the next bar using IsFirstTickOfBar:
private bool SignalGenerated = false;
if (IsFirstTickOfBar)
{
SignalGenerated = false;
}
if (your conditions to generate signal && SignalGenerated == false)
{
SignalGenerated = true;
// generate your signal here
}
Please let us know if we may be of further assistance to you.
-
Ah, that's a great idea setting up a bool signal to prevent it from constantly evaluating, thank you for the help!
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
31 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
20 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
12 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
18 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
20 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Comment