• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using indicator from ES on Currency Futures Chart

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

    Using indicator from ES on Currency Futures Chart

    Hello,

    I have an indicator which when I place it on an ES chart, produces a crossover of a red and blue line in a kind of curving pattern. The scale is justified to the left and generally runs from -1 up to +8. You can see it in panel 1 of the attached image (ES with Indicator). In the third panel of the image is the same indicator, but used only once this time, and with a longer period, and again it curves up and down.

    When I put this indicator on a currency futures chart – GBP/USD (6B) – see image attached, it results in flat lines or thin towers (in panels 1 & 3), which really give no information. It seems it may be because the scale justification on the left has jumped from -1 to 8 on the ES to as high as 75000M on the currency futures chart. Is there a standard way of adjusting this type of indicator which works on an ES chart so that it works on a currency futures chart?

    Thank you.
    Attached Files

    #2
    Hello GeorgeW, and thank you for your question.

    The underlying problem here is that you have some data with very large numbers, and some data with very small numbers. If you try to display both at the same time, you get what you observed. The choice you have to make as a programmer, then, is whether or not you filter out data, so you are only looking at data with small numbers, or if you want to change your data so that, as numbers get bigger and bigger, it gets harder and harder for a difference to show up in your plot.

    Filtering out high values is trivially easy, but for completeness, you can do it like this :
    Code:
    if (Close[0] > filterValue) return;
    One standard way of doing the second thing is to use a logarithmic function. The easiest way to explain these without using too much in the way of math is with an example. If we use a base 10 logarithm, then we can take this sequence and count the zeroes to get the output value, that is

    log10(1) = 0
    log10(10) = 1
    log10(100) = 2
    log10(1000) = 3
    log10(10000) = 4

    C# has a function that would do this for you. This will allow you to plot small and large values on the same chart, while still seeing differences, because

    log10(5) = 0.700
    log10(8) = 0.903
    log10(75000) = 4.88

    Here is the log10 function in C#

    Code:
    public static double log10(double x)
    {
        if (x < 0)
        {
            return 0;
        }
        return Math.Log(x, 10.0);
    }
    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thanks, JessicaP.
      The filter looks the easiest option, but I'll probably give both a try and see what the results look like.

      Comment


        #4
        Just to report back, using Log10 in the indicator has worked well to keep the scale within reasonable limits.
        Code:
        myDataSeriesBear.Set(Math.Log10(bearVolPerTick / bullVolPerTick)/Period);
        myDataSeriesBull.Set(Math.Log10(bullVolPerTick / bearVolPerTick)/Period);
        Thanks.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bbdjad, Today, 04:36 AM
        0 responses
        4 views
        0 likes
        Last Post bbdjad
        by bbdjad
         
        Started by mittie3, Today, 03:33 AM
        0 responses
        7 views
        0 likes
        Last Post mittie3
        by mittie3
         
        Started by Againmain1, Today, 03:04 AM
        0 responses
        8 views
        0 likes
        Last Post Againmain1  
        Started by tonytimpa, Today, 01:33 AM
        0 responses
        5 views
        0 likes
        Last Post tonytimpa  
        Started by kiwidtrader, Yesterday, 11:49 PM
        0 responses
        5 views
        0 likes
        Last Post kiwidtrader  
        Working...
        X