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

Indicator getting the Highest Price

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

    Indicator getting the Highest Price

    Hello,

    Is it possible to create an indicator that stores the highest price but just when the Stochastic is below a determined level such as 40??
    I would like to create an indicator so that you can keep the highest price when the Stochastic is below 40, and then in a strategy open a position if High [0] is > than the highest stored in the indicator.

    If it is possible, is there any sample I could see to try to do it?

    Thanks

    Daniel

    #2
    Hello Daniel,
    You can custom code and assign a variable to do it. A sample code will be like:

    In variable region
    Code:
    double highPrice = 0;
    in OnBarUpdate
    Code:
    double highPrice = 0;
    if (Stochastics(7,14,3)[0] < 40)
    	highPrice = Math.Max(highPrice, High[0]);
    else highPrice = 0;
    
    if (highPrice != 0 && other conditions)
    {
    	//do something
    }
    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      I tried to adapt it to my strategy but it is not opening any position. I e-mailed the code to you and explained the problem

      Thanks

      Daniel

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by traderqz, Today, 12:06 AM
      5 responses
      8 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by Mongo, Today, 11:05 AM
      2 responses
      7 views
      0 likes
      Last Post Mongo
      by Mongo
       
      Started by guillembm, Today, 11:25 AM
      0 responses
      3 views
      0 likes
      Last Post guillembm  
      Started by Tim-c, Today, 10:58 AM
      1 response
      3 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by traderqz, Yesterday, 09:06 AM
      4 responses
      29 views
      0 likes
      Last Post traderqz  
      Working...
      X