Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Keeping First Buy/Sell Signal
Collapse
X
-
Hello aligator,
Thanks for your post.
We do not have a helper method available for this task, but you could use bools to control the logic so it only occurs once until the some other logic resets the bool. For example:
Code:private bool SingalActive = false; protected override void OnBarUpdate() { // Our signal which should only be fired once. if (Close[0] < Open[0] && !SignalActive) { //Do Something once here. It will happen only the first time this condition becomes true. SignalActive = true; } // Opposing signal, when the bool should be reset. if (Close[0] > Open[0] && SignalActive) { //Do Something once here SignalActive = false; } }
- Likes 1
Leave a comment:
-
Keeping First Buy/Sell Signal
Dear Support,
A simple indicator draws many buy and sell arrows when price is above and below RSI 50 line.
I am looking for a sample script that will keep only the first instance of a buy signal and will not draw another buy signal until after a sell signal, and so on.
I know we can use a crossover method for the case of RSI, however, I am looking for a method in general to keep only the first instance of a signal until after an opposing signal is generated.
Many thanks.Last edited by aligator; 03-11-2019, 12:18 PM.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by geddyisodin, Today, 05:20 AM
|
3 responses
20 views
0 likes
|
Last Post Today, 09:36 AM | ||
Started by lorem, Today, 09:18 AM
|
1 response
4 views
0 likes
|
Last Post
by lorem
Today, 09:30 AM
|
||
Started by bmartz, Today, 09:30 AM
|
0 responses
3 views
0 likes
|
Last Post
by bmartz
Today, 09:30 AM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
14 responses
3,245 views
0 likes
|
Last Post
by GussJ
Today, 09:28 AM
|
||
Started by ArkansasClint, Today, 09:28 AM
|
0 responses
2 views
0 likes
|
Last Post Today, 09:28 AM |
Leave a comment: