Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Key Reversal Indicator

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

  • bo9204.pcap
    replied
    # 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);​

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    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.

    Leave a comment:


  • xamer
    replied
    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

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    Hello Mike8085,

    Thanks for the note.

    Please see the conversion attached.
    Attached Files

    Leave a comment:


  • xamer
    replied
    Hi Cal,
    would be able to make these scripts NT8 compatible please?

    Leave a comment:


  • NinjaTrader_CalH
    replied
    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

    Leave a comment:


  • Mike8085
    replied
    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.

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    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.

    Leave a comment:


  • Mike8085
    started a topic Key Reversal Indicator

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by nandhumca, Today, 03:41 PM
0 responses
4 views
0 likes
Last Post nandhumca  
Started by The_Sec, Today, 03:37 PM
0 responses
3 views
0 likes
Last Post The_Sec
by The_Sec
 
Started by GwFutures1988, Today, 02:48 PM
1 response
5 views
0 likes
Last Post NinjaTrader_Clayton  
Started by ScottWalsh, 04-16-2024, 04:29 PM
6 responses
33 views
0 likes
Last Post ScottWalsh  
Started by frankthearm, Today, 09:08 AM
10 responses
36 views
0 likes
Last Post frankthearm  
Working...
X