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 getting started on this.

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

    help getting started on this.

    Hi All,

    I am considering creating a ^TICK data indicator and could use a few helpful tips and suggestions before I get started.

    1) The Inspiration : So that we are all on the same page. If you look at pic 1 (taken on TICK on 7.7.15) you can see by the colored boxes that ES trended down until about 11:37 where it reversed and trended up the rest of the day. Pic 2. The additional cyan boxes show where the trend stopped and balanced for like a half hour (the first one) or flat out did a short term downtrend as the TICK made zero higher highs for about a half hour.

    2) The Idea: I'd like to create an indicator that points out:
    a) "80% of TICK data is up (above zero line) for the last 4 hours" = "uptrend"
    b) "no more than 55% of TICK data is up or down for the last 1/2 hour...balancing"
    c) "There have been X TICK extremes up, and X TICK extremes down in the last 15 minutes" (or whatever time frame)
    d) (pic 3) "TICK extreme against current trend...potential entry signal if trend resumes"
    e) at the worst case, could be the red/yellow/green lights over the last x periods of time...LOL

    3) Help: Any suggestions? Questions? Comments? Needs, wants and/or desires?

    Lastly, how do I gather and store this data to analyze in the first place?

    I think, that if this is done correctly...big "IF" on my part, that this could be the ultimate momentum indicator intra-day. I suppose it must be intra-day too, since TICK data only happens during RTH (regular trading hours).

    Thanks in advance for any and all help.
    Attached Files

    #2
    Hello Darth_Trader,

    Wanted to give you a few tips.

    There are a few ways that you could approach this.

    To draw the uptrend rectangle you need 4 points. The start bar (x1) and the bottom of the rectangle (y1) (I think the low of the bar), then you also need the last bar of the rectangle (x2) and the top of the rectangle (I think the highest high reached in that time period).

    The reverse would be true for the downtrend.

    A question, do you want every 4 hours marked as either an uptrend or downtrend, or do you want to mark a period only if it has been in an uptrend for the last 4 hours (leaving areas on the chart that are not either uptrend or downtrend)?

    As data is received, you can save the bar number of the first bar that fits the criteria to an integer, save the price of the low of the bar, and flag a bool that the trend is up.

    (in #region Variables)
    int trendStartBar = 0;
    double trendStartPrice = 0;

    (in OnBarUpdate)
    if (upTrend != true /* && conditions here for uptrend */)
    {
    trendStartBar = CurrentBar;
    trendStartPrice = Low[0];
    upTrend = true;
    }

    Then as long as the conditions are still true, the box is drawn from the starting point to the current bar. A BarsAgo value is needed for this. To find bars ago use CurrentBar - trendStartBar.

    Also, you need to find the highest high in however many bars that is.

    if (upTrend == true /* && conditions for uptrend */)
    {
    DrawRectangle("upTrend"+startTrendBar, true, CurrentBar-startTrendBar, startTrendPrice, 0, HighestBar(High, CurrentBar-startTrendBar)[0], Color.Green, Color.Green, 5);
    }

    As long as the condition is true, the rectangle continues to expand, then after its no longer true, it remains at its current size and is finished drawing.


    Doing this every 4 hours would likely be easier as you would likely have a datetime variable that holds the session open time, then you just check if its been 4 hours. after 4 hours you loop through the bars and see if it was a downtrend or uptrend.

    To loop through the bars you can start at the current bar and move backwards until the time is 4 hours before the current bar.

    for (int i = CurrentBar; i > Bars.GetBar(Time[0].AddHours(-4)); i--)
    {
    }

    Using CurrentBar - Bars.GetBar(Time[0].AddHours(-4)) this would give you the starting bars ago value to use for the rectangle.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Aviram Y, Today, 05:29 AM
    0 responses
    1 view
    0 likes
    Last Post Aviram Y  
    Started by quantismo, 04-17-2024, 05:13 PM
    3 responses
    25 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by ScottWalsh, 04-16-2024, 04:29 PM
    7 responses
    34 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by cls71, Today, 04:45 AM
    0 responses
    6 views
    0 likes
    Last Post cls71
    by cls71
     
    Started by mjairg, 07-20-2023, 11:57 PM
    3 responses
    216 views
    1 like
    Last Post PaulMohn  
    Working...
    X