Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Key Reversal Indicator

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

    Key Reversal Indicator

    Dear All,

    Cheers, please anyone can tell me how to edit both the NJ7 Key Reversal UP & Down indicator's plot style (Triangle Up & Down) to displace at the trigger bar above & below with space instead of displace it on top of the chart.

    Yours kindly help will be appreciate.


    Kindly Regards,
    Michael

    #2
    Michael, I'm not exactly sure which indicator you refer to here as the default NT7 Key Reversal indicators would output a binary value (0 or 1). Generally it sounds like you would need to check into where the plot value is set for the given bar and then add / substract multiples of TickSize to it to create the spacing desired.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Key Reversal Indicator

      Dear Bertrand,

      Attached screen image that stated what I want to do.

      Thanks
      Last edited by Mike8085; 06-11-2013, 09:49 AM.

      Comment


        #4
        Hi Mike8085,

        Thank you for the screenshot.

        I have attached two .Zip files that will allow you to have the key reversal plot above and below the bars as needed.

        You will need to download and import them into NinjaTrader.

        To Import

        * Download the indicator to your desktop, keep them in the compressed .zip file.
        * From the Control Center window select the menu File> Utilities> Import NinjaScript
        * Select the downloaded .zip file
        * NinjaTrader will then confirm if the import has been successful.


        Critical - Specifically for some indicators, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

        Please let me know if I can be of further assistance.
        Attached Files
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Hi Cal,
          would be able to make these scripts NT8 compatible please?

          Comment


            #6
            Hello Mike8085,

            Thanks for the note.

            Please see the conversion attached.
            Attached Files
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Thank you Cal...

              one more question pls..

              is it possible to plot the high and the low of the previous bar on the dom????

              thank you in advance

              Comment


                #8
                Hello xamer,

                Thanks for the reply.

                The scripts that I posted are meant for educational purposes. I will leave any additional features and additions as an exercise for the reader. You would need to develop a SuperDOM column to define logic that would accomplish this.



                Please let us know if you have any questions.
                Chris L.NinjaTrader Customer Service

                Comment


                  #9
                  # trendType: The choice between using modified or unmodified True Range depends on the specific trading strategy and the trader's preferences. The modified method may provide smoother values when there are gaps or sudden changes in price, whereas the unmodified method is simpler and more commonly used. In the provided code, you can choose between these two methods using the trendType input parameter.

                  # ATRPeriod: Traders often experiment with different ATR periods to tailor the indicator to their trading style and the specific assets they are analyzing. A shorter ATR period might be suitable for short-term traders looking for quick signals, while a longer ATR period might be preferred by longer-term investors looking for a more stable assessment of volatility. Changing this will tell the script how many candles you want the script to look back before calculating a decision to plot an arrow. Defaut is 2 ATRPeriod.

                  # ATRFactor: It's important to note that the ATRFactor parameter is a key part of risk management in trading. By adjusting this factor, traders can control the level of risk they are willing to take on each trade, helping to protect their capital and manage their overall portfolio risk. It's a good practice to test different ATRFactor values and analyze their impact on your trading strategy's performance before using them in live trading. Think of it as a stop loss. Adjusting this will affect arror placement. Changing this to 1 will plot and arrow sooner after a trend reversal is detected. Default is 1.5 ATR.

                  # WARNING: Just like all indicators, if a stock is channeling, squeezing or consolidating you will get multiple up and down arrows. Wait for a breakout up or down to get the larger trend run. If you are in a trend take profits as the trend takes place. Do not wait on an arrow to sell or cover all held shares.

                  # Important: If you change the defualt ATRPeriod and ATRFactor you will also need to go into the scan code and change those settings to match.


                  input trendType = {default modified, unmodified};
                  input ATRPeriod = 2;
                  input ATRFactor = 1.5;
                  input TradeType = {default long, short};
                  input averageType = AverageType.WILDERS;

                  Assert(ATRFactor > 0, "'atr factor' must be positive: " + ATRFactor);

                  def HiLo = Min(high - low, 1.5 * Average(high - low, ATRPeriod));
                  def HRef = if low <= high[1]
                  then high - close[1]
                  else (high - close[1]) - 0.5 * (low - high[1]);
                  def LRef = if high >= low[1]
                  then close[1] - low
                  else (close[1] - low) - 0.5 * (low[1] - high);

                  def trueRange;
                  switch (trendType) {
                  case modified:
                  trueRange = Max(HiLo, Max(HRef, LRef));
                  case unmodified:
                  trueRange = TrueRange(high, close, low);
                  }
                  def loss = ATRFactor * MovingAverage(averageType, trueRange, ATRPeriod);

                  def direction = {default init, long, short};
                  def trend;
                  switch (direction[1]) {
                  case init:
                  if (!IsNaN(loss)) {
                  switch (TradeType) {
                  case long:
                  direction = direction.long;
                  trend = close - loss;
                  case short:
                  direction = direction.short;
                  trend = close + loss;
                  }
                  } else {
                  direction = direction.init;
                  trend = Double.NaN;
                  }
                  case long:
                  if (close > trend[1]) {
                  direction = direction.long;
                  trend = Max(trend[1], close - loss);
                  } else {
                  direction = direction.short;
                  trend = close + loss;
                  }
                  case short:
                  if (close < trend[1]) {
                  direction = direction.short;
                  trend = Min(trend[1], close + loss);
                  } else {
                  direction = direction.long;
                  trend = close - loss;
                  }
                  }

                  def BuySignal = Crosses(direction == direction.long, 0, CrossingDirection.ABOVE);
                  def SellSignal = Crosses(direction == direction.short, 0, CrossingDirection.ABOVE);

                  plot ArrowUp = if BuySignal then 1 else 0;
                  arrowUp.SetPaintingStrategy(PaintingStrategy.BOOLE AN_ARROW_UP);
                  arrowUp.SetDefaultColor(Color.YELLOW);

                  plot ArrowDown = if SellSignal then 1 else 0;
                  arrowDown.SetPaintingStrategy(PaintingStrategy.BOO LEAN_ARROW_DOWN);
                  arrowDown.SetDefaultColor(Color.YELLOW);​

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Christopher_R, Today, 12:29 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post Christopher_R  
                  Started by sidlercom80, 10-28-2023, 08:49 AM
                  166 responses
                  2,235 views
                  0 likes
                  Last Post sidlercom80  
                  Started by thread, Yesterday, 11:58 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post thread
                  by thread
                   
                  Started by jclose, Yesterday, 09:37 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post jclose
                  by jclose
                   
                  Started by WeyldFalcon, 08-07-2020, 06:13 AM
                  10 responses
                  1,415 views
                  0 likes
                  Last Post Traderontheroad  
                  Working...
                  X