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

arrow issues

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

  • simpletrades
    replied
    Thanks for your help in Nov about getting my arrows and dots to print.
    I'm trying to take it further and write indicators to paint the bar after an up arrow blue if it moved up 5 or more ticks but go back to normal if it slips under 5 and another for red on Short for the candle after an arrow down if price moves 5 or more ticks down.
    (I use lime for up candles and violet for down so red will stand out).

    I cant make it work.
    I have it working for the dots indicator but not the arrows.
    I'm attaching my code for the dots and the red paintbar after a dot (I call them Type 1
    THEY WORK, I don't need help on them but thought you'd understand better what I want.
    I'm also attaching the code for a down arrow I'm calling type 2 Short....) which you helped me with when it wasn't always plotting consistently and also how to keep from getting multiple arrows.
    In the paintbar case I only want it to plot on the first post arrow bar.
    Some of my tries had it painting after any bar following a bar that met the arrow conditions even if it was a bar that didn't plot one because you showed me how to prevent multiples in a row.
    Other times bars that should be lime were violet intabar but if I went to my Indicators list and hit Apply it would go to lime.
    I've tried so many different changes I don't even have that version anymore.
    Attached Files

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello simpletrades,

    Thanks for your post.

    This seems like a lot of work to just add 12 emas to a chart as you can add them to chart manually then create a template of the chart.

    Period is a public variable that can be set by the user. Each variable must be unique so if you want the user to be able to set each period then you would need 11 more and different period variables, such as Period1, Period2, Period3, etc. and 11 more inputs in the regions variables.

    If you did not want the user to be able to set each one then you would make them private variables similar to how the constant1 and 2 are private. Also you will need 11 more pairs of constants, ech uniquely named as well, perhaps constant1a, constant2a, etc.

    Each of the added plots need a unique name, for example:

    AddPlot(Brushes.LightBlue, "myEMA3");
    AddPlot(Brushes.Cyan, "myEMA5");
    AddPlot(Brushes.Blue, "myEMA8");
    etc.etc.

    You will need to modify the Value[0] line to:

    myEMA3[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1 + constant2 * myEMA3[1]);

    and then add that 11 times and change as follows:

    myEMA5[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1a + constant2a * myEMA5[1]);
    myEMA8[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1b + constant2b * myEMA8[0]);
    etc.etc.
    Finally in the regions properties you will need to add the outputs, for example:

    [Browsable(false)]
    [XmlIgnore]
    public Series<double> MyEMA3
    {
    get { return Values[0]; }
    }

    [Browsable(false)]
    [XmlIgnore]
    public Series<double> MyEMA5
    {
    get { return Values[1]; }
    }

    [Browsable(false)]
    [XmlIgnore]
    public Series<double> MyEMA8
    {
    get { return Values[2]; }
    }
    etc.
    etc.

    Alternatively, it might actually be easier for you to create a new indicator using the indicator wizard and entering in the 12 plots there as it will create all the structure for you. Just remember each plot needs a unique name. Instead of recreating the EMA code you could then just call it like

    myEMA3[0] = EMA(3)[0];
    myEMA5[0] = EMA(5)[0];
    etc.
    etc.

    Leave a comment:


  • simpletrades
    replied
    I also sent the log and trace files but forgot to include the reference number.
    The error referenced the onstatechange as being the problem because "added plots or lines must have a unique name".
    I attached the cs file.
    All I did was take the Ninja EMA indicator and repeat the Period 11 more times to provide 12 total EMAs and to add 11 more AddPlot lnes to give all 12 colors.
    I also tried adding the period number (3, 5, 8...) after .NinjaScriptIndicatorNameEMA); so they would be unique making it read NinjaScriptIndicatorNameEMA3); etc... but then it didn't even compile.
    Attached Files
    Last edited by simpletrades; 11-25-2016, 11:07 AM.

    Leave a comment:


  • NinjaTrader_JessicaP
    replied
    Please send me your log and trace files so that I may look into what occurred.
    You can do this by going to the Control Center-> Help-> Mail to Platform Support.
    Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.
    Please reference the following ticket number in the body of the email: 1597771

    Leave a comment:


  • simpletrades
    replied
    I just tried creating Guppy on Ninja 8--it's just 12EMAs in one package.
    I compiled it, no errors, can see it in Documents on my pc under bin/custom/indicators after the Ninja provided ones are listed but on a chart it is not in the indicator list.
    It also appears in the tab for NinjaScript editor if I click on Indicators,
    How do I add it to my chart?
    Thanks and Happy Thanksgiving.

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello simpletrades,

    Thanks for your reply.

    NinjaTrader 8 will install separately from Ninjatrader7 you can actually have both on your computer and use one or the other without issue. NinjaTrader7 will be supported for quite some time so there is no mandate to upgrade until you are ready to.

    As far as converting the code you have already created, the changes in your code are not that extensive so it certainly can be done and just requires patience and the helpguide.

    Leave a comment:


  • simpletrades
    replied
    With my limited skill will I have hard time redoing the 2 types?
    Based on what you saw up to now
    and can I unupgrade if I cant fix them?.

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello,

    Thanks for your post.

    All NT7 scripts would need to be rewritten for NT8.

    Leave a comment:


  • simpletrades
    replied
    Will those scripts you helped with for the arrows and dots be ninja 8 compatible or will I need to rewrite parts of them if I switch?

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello simpletrades,

    Thanks for your post.

    To change the color of a prior bar use BarColorSeries[int barsAgo] Please see: http://ninjatrader.com/support/helpG...olorseries.htm

    Alternatively if you only wish to set the color of the current bar, then you could use: BarColor. Please see: http://ninjatrader.com/support/helpG.../?barcolor.htm

    Both references contain examples of use.

    Leave a comment:


  • simpletrades
    replied
    How would I write a program just to recolor the 3rd bar of the same color on its close?
    If Close[0]>Open[0] && Close[1]>Open[1] && Close[2]>Open[2] then what?

    Leave a comment:


  • simpletrades
    replied
    thanks for all your help

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello simpletrades,

    Thanks for your post.

    You can use /* at the beginning of the section to block out and then */ to end.

    Reference: http://ninjatrader.com/support/helpG...sic_syntax.htm

    Leave a comment:


  • simpletrades
    replied
    when I want to block out multiple lines of code but not do // each line, isn't there a way to block out multiple lines at once?

    Leave a comment:


  • simpletrades
    replied
    Thanks i was testing the sounds on a 30 sec chart and that change makes a big difference,

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by helpwanted, Today, 03:06 AM
1 response
10 views
0 likes
Last Post sarafuenonly123  
Started by Brevo, Today, 01:45 AM
0 responses
9 views
0 likes
Last Post Brevo
by Brevo
 
Started by aussugardefender, Today, 01:07 AM
0 responses
5 views
0 likes
Last Post aussugardefender  
Started by pvincent, 06-23-2022, 12:53 PM
14 responses
242 views
0 likes
Last Post Nyman
by Nyman
 
Started by TraderG23, 12-08-2023, 07:56 AM
9 responses
387 views
1 like
Last Post Gavini
by Gavini
 
Working...
X