Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Uptick & Downtick

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

    Uptick & Downtick

    Can someone tell me how to translate this ELD code in C" ?

    Value1 = upticks + downticks;

    #2
    I also have another question.
    What is the equivalent of "Bartype" (easylanguage) in Ninjascript language ?

    Comment


      #3
      We do not have a concept of upticks/down ticks since most if not all of our feed providers do not track this data. You would need to self code and track this yourself.

      Bartype??

      http://www.ninjatrader-support.com/H...V6/Period.html
      RayNinjaTrader Customer Service

      Comment


        #4
        here is the script I'm trying to translate. This is an improved version of the Better volume beta available on NT (provided by Goldfly). The only things I need yo know are what kind of trick can I use to code up&downticks in C# and what does this "BarType" mean.
        Once I have these answers I might be able to port this indicator using better volume beta Ninjascript.
        I'll be happy to share it with the NT community if I succeed but I really need your help.
        hope you will understand and give me a little hand.


        Better Volume Indicator

        Inputs: LowVol(True), ClimaxUp(True), ClimaxDown(True), Churn(True), ClimaxChurn(True), Color(Cyan), LowVolColor(Yellow), ClimaxUpColor(Red), ClimaxDownColor(White), ChurnColor(Green), ClimaxChurnColor(Magenta), AvgColor(Red);
        Variables: BarColor(Cyan), Lookback(20);

        BarColor = Color;

        If BarType > 1 then begin
        Value1 = V;
        Value2 = V*Range;
        If Range <> 0 then Value3 = V/Range;
        Condition1 = Value1 = Lowest(Value1,Lookback);
        Condition2 = Value2 = Highest(Value2,Lookback);
        Condition3 = Value3 = Lowest(Value3,Lookback);
        Condition4 = Value3 = Highest(Value3,Lookback);
        If LowVol and Condition1 then BarColor = LowVolColor;
        If ClimaxUp and Condition2 and C > O then BarColor = ClimaxUpColor;
        If ClimaxDown and (Condition2 or Condition3) and C < O then BarColor = ClimaxDownColor;
        If Churn and Condition4 then BarColor = ChurnColor;
        If ClimaxChurn and Condition4 and ((Condition2 and C > O) or ((Condition2 or Condition3) and C < O)) then BarColor = ClimaxChurnColor;
        End;

        If BarType <= 1 then begin
        Value1 = UpTicks+DownTicks;
        Value2 = UpTicks*Range;
        Value3 = (UpTicks-DownTicks)*Range;
        Value4 = DownTicks*Range;
        Value5 = (DownTicks-UpTicks)*Range;
        If Range <> 0 then begin
        Value6 = UpTicks/Range;
        Value7 = (UpTicks-DownTicks)/Range;
        Value8 = DownTicks/Range;
        Value9 = (DownTicks-UpTicks)/Range;
        Value10 = (UpTicks+DownTicks)/Range;
        End;
        Condition1 = Value1 = Lowest(Value1,Lookback);
        Condition2 = Value2 = Highest(Value2,Lookback);
        Condition3 = Value3 = Highest(Value3,Lookback);
        Condition4 = Value4 = Highest(Value4,Lookback);
        Condition5 = Value5 = Highest(Value5,Lookback);
        Condition6 = Value6 = Lowest(Value6,Lookback);
        Condition7 = Value7 = Lowest(Value7,Lookback);
        Condition8 = Value8 = Lowest(Value8,Lookback);
        Condition9 = Value9 = Lowest(Value9,Lookback);
        Condition10 = Value10 = Highest(Value10,Lookback);
        If LowVol and Condition1 then BarColor = LowVolColor;
        If ClimaxUp and (Condition2 or Condition3 or Condition8 or Condition9) and C > O then BarColor = ClimaxUpColor;
        If ClimaxDown and (Condition4 or Condition5 or Condition6 or Condition7) and C < O then BarColor = ClimaxDownColor;
        If Churn and Condition10 then BarColor = ChurnColor;
        If ClimaxChurn and Condition10 and (((Condition2 or Condition3 or Condition8 or Condition9) and C > O) or ((Condition4 or Condition5 or Condition6 or Condition7) and C < O)) then BarColor = ClimaxChurnColor;
        End;

        Plot1(Value1,"Volume",BarColor);
        Plot2(Average(Value1,100),"Avg",AvgColor);

        Comment


          #5
          I don't know what BarType is. Maybe its same thing as the link I provided for determine what the bar interval is. For up/down ticks, you could only calculate this in real-time. Compare the current price to the last price to see if its up or down etc... and start counting etc...
          RayNinjaTrader Customer Service

          Comment


            #6
            Here is what I found on TS FAQ. Maybe this will help you to tell me what is the equivalent on NT :

            The effectiveness of an EasyLanguage document can depend on the data compression being used by the chart to which it is applied. BarType and BarInterval are EasyLanguage functions available for this very purpose.
            The following restricts processing of the EasyLanguage document to a daily chart.
            Example
            If BarType = 2 then begin
            Plot1(Close,"Close");
            End;
            The following restricts processing of the EasyLanguage document to a 5-minute chart.
            If BarType = 1 and BarInterval = 5 then begin
            Plot1(Close,"Close");
            End;

            Comment


              #7
              Please look at the link I provided in post #3, this is what you want.
              RayNinjaTrader Customer Service

              Comment


                #8
                ok thanks. So if I really understood the thing,

                Bartype<=1 is equivalent to Bars.Period.Id == PeriodType.Tick or .Second or .Minute
                Bartype>1 is equivalent to Bars.Period.Id == PeriodType.Day or .Week or any higher time frame

                Am I right ?

                Comment


                  #9
                  Originally posted by kuroro13 View Post
                  ok thanks. So if I really understood the thing,

                  Bartype<=1 is equivalent to Bars.Period.Id == PeriodType.Tick or .Second or .Minute
                  Bartype>1 is equivalent to Bars.Period.Id == PeriodType.Day or .Week or any higher time frame

                  Am I right ?
                  Maybe this help you http://www.ninjatrader-support.com/v...1&pp=15&sort=d

                  Comment


                    #10
                    Bar Type

                    This also may help - from Easy Language..

                    BAR Type
                    The compression setting of the price data for the applied analysis technique.
                    Returns: 0 forTick, 1 for Intraday, 2 for Daily, 3 for Weekly, 4 for Monthly, 5 for Point & Figure.
                    Usage: If BarType = 2 Then {Any Operation} {tests for daily bars}

                    Comment


                      #11
                      I think I get it. thanks

                      How can you compare 2 ticks value ? (this is for building up&downticks)

                      Comment


                        #12
                        Store the current tick in a variable, then when the next one comes in compare it the one storted in the variable.
                        RayNinjaTrader Customer Service

                        Comment


                          #13
                          store ? I think I don't understand

                          you mean :

                          value1=Ticksize then compare value1 with next Ticksize ?

                          Can you give me an example, please ?

                          Comment


                            #14
                            - declare a variable
                            - assign this variable the value of Close[0]
                            - Then on next time OnBarUpdate() is called, compare the Close[0] to the variable to see if its up or down
                            RayNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by sidlercom80, Today, 02:40 AM
                            1 response
                            13 views
                            0 likes
                            Last Post NinjaTrader_PaulH  
                            Started by b16_aln, Today, 01:52 AM
                            0 responses
                            14 views
                            0 likes
                            Last Post b16_aln
                            by b16_aln
                             
                            Started by junkone, Yesterday, 08:55 PM
                            2 responses
                            11 views
                            0 likes
                            Last Post junkone
                            by junkone
                             
                            Started by adaeiqendqw, 01-16-2021, 02:56 AM
                            1 response
                            17 views
                            0 likes
                            Last Post NinjaTrader_Jason  
                            Started by [email protected], Yesterday, 06:10 PM
                            5 responses
                            17 views
                            0 likes
                            Last Post NinjaTrader_ChrisSch  
                            Working...
                            X