Announcement

Collapse
No announcement yet.

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 CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      23 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      17 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      182 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      335 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      259 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X