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!
See more
See less

Partner 728x90

Collapse

Keeping First Buy/Sell Signal

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • aligator
    replied
    Originally posted by NinjaTrader_Jim View Post
    Hello aligator,

    Please let us know if we can be of further assistance
    Thanks so much Jim, perfect.

    Leave a comment:


  • NinjaTrader_Jim
    replied
    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;
        }
    }
    Please let us know if we can be of further assistance

    Leave a comment:


  • aligator
    started a topic Keeping First Buy/Sell Signal

    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.

Latest Posts

Collapse

Topics Statistics Last Post
Started by geddyisodin, Today, 05:20 AM
3 responses
20 views
0 likes
Last Post NinjaTrader_Gaby  
Started by lorem, Today, 09:18 AM
1 response
4 views
0 likes
Last Post lorem
by lorem
 
Started by bmartz, Today, 09:30 AM
0 responses
3 views
0 likes
Last Post bmartz
by bmartz
 
Started by GussJ, 03-04-2020, 03:11 PM
14 responses
3,245 views
0 likes
Last Post GussJ
by GussJ
 
Started by ArkansasClint, Today, 09:28 AM
0 responses
2 views
0 likes
Last Post ArkansasClint  
Working...
X