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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      574 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      332 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X