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

Help with Strategy builder

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

    Help with Strategy builder

    Hi,

    (1) I was trying to make a strategy where a green up arrow is printed below bar on the chart when a Fast, say 3 period, MA crosses above a Slow, say 20 period, MA and a red down arrow is plotted above bar when the Fast MA crosses under the Slow MA?

    (2) I was able to get arrow on the cross above but only the last arrow remained on the chart - all previous arrows printed below bar on cross above disappeared from chart even though the bar was still visible - i.e. only the last cross above was visible.

    (3) Please point me to a Strategy builder example which will help me understand how to go about implementing this strategy and to any tutorial on this.

    (4) Also is it possible to plot a ribbon in a lower panel with ribbon color green after cross above and red after cross under?

    (5) How to modify above strategy so as to plot arrows / ribbon color when say NinjaTrader indicator like RSI - the RSI plot crosses above/below the AVG plot?

    thanks

    suraj

    #2
    Hello suraj,

    Thanks for your post.

    You would need to make sure you are passing in a unique tag name so that the draw objects appear historically. This could be accomplished by adding CurrentBar (Misc folder > Current bar) to the Tag parameter of the Draw method in your script.

    If the same Tag is being used, the draw object will be updated to the new location each time the Draw method is called. If you pass in a unique tag name, a new draw object will be created each time the Draw method is called.

    See this help guide page for more information about using a unique tag name such as CurrentBar for a Drawing method: https://ninjatrader.com/support/help...ToDrawOnAChart

    So we may accurately assist, what exactly are you referring to by a "ribbon"?

    Are you wanting to add a plot line to the strategy that appears in an indicator panel and assign a value to the plot?

    We look forward to assisting further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hi Brandon,
      thanks for your quick reply. I will have to read through the guide and use unique tag names.

      >>So we may accurately assist, what exactly are you referring to by a "ribbon"?

      what I want to do is to make wide colored lines (in panel 2 say) where say top wide line is green if say 10 SMA is above 20 SMA or red if below 20 SMA. Second wide line is green when say 50 SMA is above 220 SMA or red if below. So looking at the panel 2 we can immediately see if short term and long term Moving Average trend is UP or DOWN
      Click image for larger version

Name:	thumb_88122.png
Views:	18
Size:	408 Bytes
ID:	1304216





      >>Are you wanting to add a plot line to the strategy that appears in an indicator panel and assign a value to the plot?​
      To help make clear the question 5) How to modify above strategy so as to plot arrows / ribbon color when say NinjaTrader indicator like RSI - the RSI plot crosses above/below the AVG plot?

      In the first case with the MAs I am trying to put an up or down arrow below or above the price bars, and plotting a ribbon in panel 2 showing at a glance if faster MA is above or below slower MA for two different MA period sets,

      Question is how to modify this so that instead of SMA I can use the Ninja Trader built in RSI indicator's RSI plot (not the average plot) and plot a up arrow below Price Bar if RSI value is above 20 and at the same time make the ribbon color green in panel 2 - or no arrow and ribbon color red if RSI value is below 20?

      Another variation on the above RSI plot is to plot the arrow and color ribbon green when RSI crosses above value of 20 and plot down arrow above bar and color ribbon Red when RSI value Crosses from above 70 to below 70.


      thanks,
      suraj

      Comment


        #4
        Hello suraj,

        Thanks for your notes.

        The AddLine() method could be used to place lines at specific value on the chart.

        Lines[int index].Width could be used to set the width of the lines.

        Lines[int index].Brush could be used to set the brush color of the lines when a certain condition is true.

        Note that this would require unlocking the script from the Strategy Builder by clicking the 'Unlock code' button and manually programming the logic in the script using the NinjaScript Editor.

        A CrossAbove()/CrossBelow() condition could be created to check if the RSI plot of the RSI indicator crosses above or below the Avg plot of the RSI indicator.

        You could create the crossover condition in a Strategy Builder strategy and click the 'View code' button to see the generated logic.

        See the help guide documentation below for more information.

        AddLine(): https://ninjatrader.com/support/help...t8/addline.htm
        Lines[int index]: https://ninjatrader.com/support/help.../nt8/lines.htm
        Lines Class: https://ninjatrader.com/support/help...line_class.htm
        CrossAbove(): https://ninjatrader.com/support/help...crossabove.htm
        CrossBelow(): https://ninjatrader.com/support/help...crossbelow.htm
        RSI(): https://ninjatrader.com/support/help..._index_rsi.htm
        Creating Crossover Conditions: https://ninjatrader.com/support/help...sOverCondition
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by crewtrades, 06-13-2024, 10:50 AM
        4 responses
        30 views
        0 likes
        Last Post crewtrades  
        Started by kingsteven, Today, 08:34 PM
        1 response
        3 views
        0 likes
        Last Post bltdavid  
        Started by biegea, Today, 08:54 PM
        0 responses
        3 views
        0 likes
        Last Post biegea
        by biegea
         
        Started by rene69851, Today, 08:36 PM
        0 responses
        2 views
        0 likes
        Last Post rene69851  
        Started by chartish, 04-11-2019, 12:40 PM
        15 responses
        3,832 views
        0 likes
        Last Post joselube001  
        Working...
        X