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

Comparing Bar OHLC with a Custom Indicator Value

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

    Comparing Bar OHLC with a Custom Indicator Value

    Hi guys,

    I'm building a strategy in NT8 using a custom VWAP indicator in circulation called VWAP8. I am able to add this indicator to my strategy and it plots fine.

    I am also able to use functions such as CrossBelow() and CrossAbove() in reference to this indicator plot, however I am looking for proper syntax to determine if the last bar closed above (or below) the plot of this indicator for example. Thanks in advance!

    #2
    Hello gambOtage,

    Thank you for your note.

    To determine if the current price closed above the vwap you would reference Close bars ago 0 and VWAP bars ago 0 with an operator of Greater.

    I attached a screen shot of how this could be done. If you were interested in whether this happened on the last bar, not the current bar, you would pass 1's to the bars ago input on both sides.

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

    Comment


      #3
      Hi Alan,

      Thank you for your assistance. I have an indicator "VWAP8" installed and similar to your solution within the Strategy Builder I am trying to add this condition in conjunction with my other criteria which does compile and run fine. The attached image is for short signal so operator is Less than the last bar.

      The compiler errors out on a double datatype error. What am I doing wrong?
      Attached Files

      Comment


        #4
        So I figured out the issue based on your suggestion. Passing [0] to the indicator name. Seems like this should work universally depending on the indicator. Thanks for your help,

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by frankthearm, Yesterday, 09:08 AM
        12 responses
        43 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by junkone, Today, 11:37 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by quantismo, 04-17-2024, 05:13 PM
        5 responses
        35 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by proptrade13, Today, 11:06 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        35 views
        0 likes
        Last Post love2code2trade  
        Working...
        X