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 an indicator please...

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

  • dendy
    replied
    Thanks KBJ,

    I'll look into this...

    dendy.

    Leave a comment:


  • KBJ
    replied
    For more info, refer to this thread also on the ATR topic:



    KBJ

    Leave a comment:


  • KBJ
    replied
    That's an interesting idea of using the ATR to set a stop-loss and it sounds like it might be very workable.

    Since the ATR is defined as the maximum of these three values:
    abs(Low[0] - Close[1])
    abs(High[0] - Close[1])
    (High[0] - Low[0])
    averaged over the last N bars, this would help find stops that automatically adjust based on recent volatility... just what I was looking for. (Thanks!)

    And I guess it would handle shorts as well as longs, unless you’re trading counter to the trend, in which case you’d probably want to have your stops smaller. Perhaps for counter-trend trades stops would better if calculated by averaging only 2 out of the above three calculations, leaving out the one that is with the trend... just a guess, I'm not sure it would work, but might be worth looking at.

    KBJ

    Leave a comment:


  • dendy
    replied
    Thanks.

    I think I have a solution using the Math.Round function.

    Leave a comment:


  • NinjaTrader_Ray
    replied
    Right, this function will not do what you want. You have to use functions that exist in the Math class which is part of C#/.NET and NOT NinjaScript.

    Here is the link to all functions of the Math Class.

    http://msdn2.microsoft.com/en-us/lib...rs(VS.71).aspx

    Leave a comment:


  • dendy
    replied
    NinjaTrader_Ray,

    I've used this function and still I cannot get the double number to round to and integer whole number. I don't know what I'm doing wrong.

    Does NT have a list of all the functions possible to use like this " Instrument.MasterInstrument.Round2TickSize(double value);" so that I can investigate any more of these options.

    Thanks...

    Leave a comment:


  • NinjaTrader_Ray
    replied
    I see.

    Math.Ceiling or Math.Floor might work? Google MSDN Math Class for documentation on the Math class and all of its methods.

    Leave a comment:


  • dendy
    replied
    Thanks Ray,

    This does round but I need the number rounded to a whole number. Not a decimal number. So if there are 4 ticks to a point, the function you provided rounds to the nearest 1/4 point. I need my numbers rounded to the nearest whole number.

    Thanks.....

    Leave a comment:


  • NinjaTrader_Ray
    replied
    You can use the following:

    Instrument.MasterInstrument.Round2TickSize(double value);

    Leave a comment:


  • dendy
    started a topic Help with an indicator please...

    Help with an indicator please...

    I am attempting to develop an indicator based on the ATR indicator in Ninja Trader that I can use for my stop loss.

    I think I almost have it done except for that I believe the values must be rounded to the nearest whole number to be used in a strategy to set the tick value of the stop loss. I don't know how to round although I've searched and found something for (Math.Round or Truncate on the web).

    Can someone help with this please? I have attached the indicator which seems to work at least to the point of plotting the values on a chart.

    Thank.
    Attached Files

Latest Posts

Collapse

Topics Statistics Last Post
Started by rjbtrade1, 11-30-2023, 04:38 PM
2 responses
75 views
0 likes
Last Post DavidHP
by DavidHP
 
Started by Stanfillirenfro, Today, 07:23 AM
3 responses
12 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by FitSpressoHonest, Today, 09:14 AM
0 responses
2 views
0 likes
Last Post FitSpressoHonest  
Started by Davide999, 05-18-2023, 03:55 AM
4 responses
557 views
1 like
Last Post kcwasher  
Started by rexsole, Today, 08:39 AM
2 responses
8 views
0 likes
Last Post NinjaTrader_Erick  
Working...
X