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

code help on GRaB candle custom script

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

    code help on GRaB candle custom script

    Hey all,

    I am replicating Raghee Horner's 34 EMA wave with GRaB candles (green, red, and blue candles).

    See attached "example image" file for what it should look like. Instead my code is filling candles nonsensically - see "error image" file for what my indicator is outputting. The code is also attached.

    I am using if...else if... statements to sort whether the candle is up or down, and whether the candle's close is above the 34 EMA on the high, between the 34 EMA on the high and low (inside the wave), or below the 34 EMA on the low. Thus, when the market breaks up through all three EMAs, up bars should be lime and down bars (but still above the wave) is dark green. Bars that are inside the channel (close, that is) should be light blue for up and dark blue for down (these are choppy bars, non-trending or reversing). Bars that are below the channel (close below red 34 EMA on lows) should be red if up bars and dark red if down bars.

    Any help / commentary / advice would be greatly appreciated! Thanks guys!

    Edit: also, ignore thinner blue moving averages. These are 13 and 21 EMAs. The GRaB candles only are colored based on the 34 EMAs, the thicker green, blue, and red EMAs that form a channel.
    Attached Files

    #2
    Hello pappal,

    Grabbing the close of ChartBars.ToIndex, is always going to return the value of the most right bar on the chart, even historically.

    Replace the closePrice variable in all your if statement with Close[0], like the following,

    if ((Close[0] > WaveHigh[0])&&(isUp))

    See ToIndex section of our helpguide,


    See Close section of our helpguide,


    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AlanP View Post
      Hello pappal,

      Grabbing the close of ChartBars.ToIndex, is always going to return the value of the most right bar on the chart, even historically.

      Replace the closePrice variable in all your if statement with Close[0], like the following,

      if ((Close[0] > WaveHigh[0])&&(isUp))

      See ToIndex section of our helpguide,


      See Close section of our helpguide,


      Please let us know if you need further assistance.
      Hey, thank you for your suggestion! That mostly fixed the issue. however, the current bar doesnt calculate correctly as does the historical bars. See error image 2. Also attached is the modified code. Any suggestions?

      Ryan
      Attached Files

      Comment


        #4
        Hello pappal,

        Are you running the indicator with CalculateOnBarClose==False?

        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_AlanP View Post
          Hello pappal,

          Are you running the indicator with CalculateOnBarClose==False?

          I look forward to your reply.
          I changed it to Calculate.OnPriceChange but this didn't resolve the issue.

          Comment


            #6
            Hello pappal,

            What is the issue exactly?

            What are you seeing vs what are you expecting?

            I look forward to your reply.
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_AlanP View Post
              Hello pappal,

              What is the issue exactly?

              What are you seeing vs what are you expecting?

              I look forward to your reply.
              Hi,
              I was wondering if this indicator was ever completed?
              Thanks in advance,
              biegea

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Irukandji, Today, 09:34 AM
              0 responses
              2 views
              0 likes
              Last Post Irukandji  
              Started by TraderBCL, Today, 04:38 AM
              3 responses
              24 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by WeyldFalcon, 08-07-2020, 06:13 AM
              11 responses
              1,423 views
              0 likes
              Last Post jculp
              by jculp
               
              Started by RubenCazorla, Today, 09:07 AM
              0 responses
              4 views
              0 likes
              Last Post RubenCazorla  
              Started by BarzTrading, Today, 07:25 AM
              2 responses
              29 views
              1 like
              Last Post BarzTrading  
              Working...
              X