Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ICT Fair Value Gap

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

    #46
    Originally posted by dj22522 View Post
    Further to my last post regarding when adding another indicator seems to mess up the FVG display.

    This happens when just hitting F5 a few times when there's more than one instance of the V 0.002 applied to the chart. So it's on a refresh and not to do with adding another indicator which by default would refresh the chart in of itself.
    I believe I had this same issue with original version when adding multiple Instruments to same chart. Try modifying the tag used to create the FVG's to add the Instrument Code.
    We could always add a random number to the mix as well to ensure we have a unique value.

    Code:
    string tag = "FVGUP" + Instrument.Id.ToString() + CurrentBar;
    
    string tag = "FVGDOWN" + Instrument.Id.ToString() + CurrentBar;

    Originally posted by dj22522
    In terms of the length of the forward display being set to the look back period, this is ok for shorter time charts but when changing from a 1 min to say 10 min or 30 min etc I then need to change the look back period to get the FVG's to display all the way to the right.
    You could make the AddDays value a static value like 30 or ChartBars.Properties.DaysBack + 30 to push it out. However, it probably makes sense to add a function to update the rectangles if they are unfilled in CheckFilledFVGs() :

    Code:
            private void CheckFilledFVGs()
            {
                List<FVG> filled = new List<FVG>();
    
                foreach (FVG fvg in fvgList)
                {
                    if (fvg.filled) continue;
    
                    if (DrawObjects[fvg.tag] != null && DrawObjects[fvg.tag] is DrawingTools.Rectangle)
                    {
                        //Update EndAnchor of Gap to Expand into future.
                        Rectangle gapRect = (Rectangle)DrawObjects[fvg.tag];
                        gapRect.EndAnchor.Time = Times[1][0].AddDays(1);
    
                        if (DisplayCE && DrawObjects[fvg.tag + "_CE"] != null && DrawObjects[fvg.tag + "_CE"] is DrawingTools.Line)
                        {
                            DrawingTools.Line gapLine = (DrawingTools.Line)DrawObjects[fvg.tag + "_CE"];
                            gapLine.EndAnchor.Time = Times[1][0].AddDays(1);
                        }
    
                    }
    
                    if (fvg.type == FVGType.R && (FillType == FVGFillType.CLOSE_THROUGH ? (Closes[1][0] >= fvg.upperPrice) : (Highs[1][0] >= fvg.upperPrice)))
                    {​
    Attached Files

    Comment


      #47
      Originally posted by gemify View Post
      Loving the discussion/contribution to make this better. Thanks dj22522 and tickets2themoon.
      I've updated the code based on your feedback. Please use the latest zip (ICTFVG-v0.0.2.1​) from here: https://github.com/OrderFlowTools/ICTFVG/releases
      Love it. I need to fire up GitHub to make this easier on everyone.

      Comment


        #48
        Originally posted by gemify View Post

        dj22522, are you attempting to display FVGs from multiple data series types/values? Ex. Display 3-Minute and 15-Minute FVGs on a 1-Minute chart?
        gemify

        Yes correct. Two instances of the ICTFVG v 0.0.2.1 each set at different time. a 1min and a 5min on a 1min chart.

        Hope this helps

        many thx

        Comment


          #49
          Originally posted by gemify View Post

          dj22522, are you attempting to display FVGs from multiple data series types/values? Ex. Display 3-Minute and 15-Minute FVGs on a 1-Minute chart?
          gemify I have seen this issue when you add multiple instances of the indicator to a chart. I have a chart that has two panels ES on top and RTY on bottom. Both series have FVG indicator applied. Since FVGs could open/close on both series at same CurrentBar value one indicator could modify the FVG Rectangles from the other one. The DrawingObjects collection is global to the entire chart where tags cannot be duplicated. Adding Indicator ID helps but still wouldn't solve the issue if you had two panels with same contract using different time frames (ie ES 1min and ES 5min). We could add the FVGSeriesPeriod to the tag. If the series and period is duplicated then it wouldn't matter as the rectangles are redrawn.

          Proposed Solution:
          Code:
          string tag = "FVGUP" + FVGSeriesPeriod + Instrument.Id.ToString() + CurrentBar;
          
          string tag = "FVGDOWN" + FVGSeriesPeriod + Instrument.Id.ToString() + CurrentBar;

          Comment


            #50
            You nailed it! I've added an instance id to distinguish between multiple instances of the indicator on the same chart - which is now used in the tag generation.
            Please try the attached version. If it works as you expect, I'll update the repo on github and submit the updated version to the ecosystem.
            Thanks for your help!
            Attached Files

            Comment


              #51
              Ok. re ICTFVG v0.0.2.2

              Having hit the F5 key 3028 times, I got a bit fed up and bored with that but pleased to say it works.

              Sincere thanks for your work gemify and help from tickets2themoon

              many thx
              Last edited by dj22522; 02-28-2023, 04:22 PM.

              Comment


                #52
                Looks good to me!

                Comment


                  #53
                  A quick question.

                  Does the future timestamp period (presently set to 50 years) have any affect on NT8 resources ?

                  Or is NT8 (pc CPU) only using what's visible on the chart. (?)

                  I assume I could change that 50 number to anything less ?

                  many thx
                  Last edited by dj22522; 02-28-2023, 04:29 PM.

                  Comment


                    #54
                    dj22522
                    I'm not sure. I don't think the chart will let you scroll forward more than a few hours on a minute chart but on a daily chart you can scroll forward for more than a year.

                    I remember seeing below line from OnRender method in @Regions.cs but that is probably because it is performing vector geometrical calculations.
                    // Now cap start/end by visibly painted bars!
                    // If you dont do this it will absolutely crush performance on larger regions

                    I still think it may be best to update the EndAnchor in the CheckFilledGaps() method so you don't have to draw it so large initially:

                    Code:
                    private void CheckFilledFVGs()
                    {
                    List<FVG> filled = new List<FVG>();
                    
                    foreach (FVG fvg in fvgList)
                    {
                    if (fvg.filled) continue;
                    
                    if (DrawObjects[fvg.tag] != null && DrawObjects[fvg.tag] is DrawingTools.Rectangle)
                    {
                    //Update EndAnchor of Gap to Expand into future.
                    Rectangle gapRect = (Rectangle)DrawObjects[fvg.tag];
                    gapRect.EndAnchor.Time = Times[1][0].AddDays(ChartBars.Properties.DaysBack);
                    
                    if (DisplayCE && DrawObjects[fvg.tag + "_CE"] != null && DrawObjects[fvg.tag + "_CE"] is DrawingTools.Line)
                    {
                    DrawingTools.Line gapLine = (DrawingTools.Line)DrawObjects[fvg.tag + "_CE"];
                    gapLine.EndAnchor.Time = Times[1][0].AddDays(ChartBars.Properties.DaysBack);
                    }
                    
                    }​

                    Last edited by tickets2themoon; 02-28-2023, 06:29 PM.

                    Comment


                      #55
                      gemify
                      You can also define FVGPeriodTypes using the values from BarsPeriodType. One advantage is custom BarTypes could be added by users like the the MinuteOpen BarType I wrote:
                      Code:
                      // Supported period types for FVG detection
                      public enum FVGPeriodTypes
                      {
                      Tick = BarsPeriodType.Tick,
                      Volume = BarsPeriodType.Volume,
                      Second = BarsPeriodType.Second,
                      Minute = BarsPeriodType.Minute,
                      MinuteOpen = 1026,
                      Day = BarsPeriodType.Day,
                      Week = BarsPeriodType.Week,
                      Month = BarsPeriodType.Month,
                      Year = BarsPeriodType.Year
                      }​


                      The AddDataSeries looks like the following, eliminating the enum parsing:

                      Code:
                      AddDataSeries((BarsPeriodType)FVGBarsPeriodType, FVGSeriesPeriod);

                      Comment


                        #56
                        tickets2themoon

                        Thank you for post 54.
                        This unfortunately created issues (?)

                        Click image for larger version

Name:	FVG -a .jpg
Views:	657
Size:	186.4 KB
ID:	1237375

                        Many thx

                        Comment


                          #57
                          gemify and tickets2themoon

                          As an aside and just thinking out loud:-

                          ICTFVG v 0.0.1.0 meant the FVG's would display for that chart increment.
                          ie: For a 1 min chart FVG's would display for that 1min chart.
                          Then if we were to change the chart increment (top left of chart drop down) to say a 5min chart then the FVG's would automatically display for that 5 min chart. Lets call these "Fixed" FVG's.

                          ICTFVG v0.0.2.2 gives us additional data series meaning we can set the Time increment within the indicator settings.
                          ie: For a 1 min chart if we select the Time in the indicator settings to 1 min we get 1 min FVG's on our 1 min chart. (same display as Fixed) Which is all fine and good. We can also set the Time as 3 min for our 1 min chart and get 3 min FGV's displayed on our 1 min chart.
                          Lets call these "Variable" FVG's.

                          If however we were to change the chart increment to say 5 min, we then need to go into indicator settings to change the Time from 1 min to 5 min to get FVG's for our 5 min chart other wise we will have 1 min FVG's displayed on our 5 min chart.


                          I understand this is the point of the v0.0.2.2 by adding ability for other data series but, and forgive my coding skill ignorance here, is there a way to have the Fixed FVG function from v0.0.1.0 and Variable FVG v0.0.2.2 at the same time ?

                          Meaning the multi data series facility of v0.0.2.2 helps by not having to load separate data series to a chart, but it means I can't change between chart time frames on the fly without then needing to go in to indicator settings to then change the Time increments for the FVG's.

                          Am I answering my own question by saying I can run an increment of a "Fixed" FVG v0.0.1.0 and add the indicator a 2nd and even 3rd time with "Variable" v0.0.2.2 ?

                          If so how do I do that when each new version over writes the previous one when Importing.

                          Or is having multiple chart Tabs with each chart time frame and ICTFVG Time increment set up as required the only alternative ?


                          As mentioned, I'm just thinking out loud and as also mentioned I'm new to this ICT methodology so I'm not experienced enough to know if or how FVG's are valid or usable yet over what ever time increments and or settings.


                          Many thx
                          Last edited by dj22522; 03-01-2023, 05:00 AM.

                          Comment


                            #58
                            Originally posted by dj22522 View Post
                            tickets2themoon

                            Thank you for post 54.
                            This unfortunately created issues (?)

                            Many thx
                            Nice colors??! Not sure where that came from.

                            Post 54 was only a partial modification to CheckFilledFVGs method.
                            Here is my entire method. I'm not experiencing any issues:

                            Code:
                                   private void CheckFilledFVGs()
                                    {
                                        List<FVG> filled = new List<FVG>();
                            
                                        foreach (FVG fvg in fvgList)
                                        {
                                            if (fvg.filled) continue;
                            
                                            if (DrawObjects[fvg.tag] != null && DrawObjects[fvg.tag] is DrawingTools.Rectangle)
                                            {
                                                //Update EndAnchor of Gap to Expand into future.
                                                Rectangle gapRect = (Rectangle)DrawObjects[fvg.tag];
                                                gapRect.EndAnchor.Time = Times[1][0].AddDays(ChartBars.Properties.DaysBack);
                            
                                                if (DisplayCE && DrawObjects[fvg.tag + "_CE"] != null && DrawObjects[fvg.tag + "_CE"] is DrawingTools.Line)
                                                {
                                                    DrawingTools.Line gapLine = (DrawingTools.Line)DrawObjects[fvg.tag + "_CE"];
                                                    gapLine.EndAnchor.Time = Times[1][0].AddDays(ChartBars.Properties.DaysBack);
                                                }
                            
                                            }
                            
                                            if (fvg.type == FVGType.R && (FillType == FVGFillType.CLOSE_THROUGH ? (Closes[1][0] >= fvg.upperPrice) : (Highs[1][0] >= fvg.upperPrice)))
                                            {
                                                if (DrawObjects[fvg.tag] != null)
                                                {
                                                    fvg.filled = true;
                                                    fvg.fillTime = Times[1][0];
                                                    filled.Add(fvg);
                                                }
                                            }
                                            else if (fvg.type == FVGType.S && (FillType == FVGFillType.CLOSE_THROUGH ? (Closes[1][0] <= fvg.lowerPrice) : (Lows[1][0] <= fvg.lowerPrice)))
                                            {
                                                if (DrawObjects[fvg.tag] != null)
                                                {
                                                    fvg.filled = true;
                                                    fvg.fillTime = Times[1][0];
                                                    filled.Add(fvg);
                                                }
                                            }
                                        }
                            
                                        foreach (FVG fvg in filled)
                                        {
                                            if (DrawObjects[fvg.tag] != null)
                                            {
                                                var drawObject = DrawObjects[fvg.tag];
                                                Rectangle rect = (Rectangle)drawObject;
                            
                                                RemoveDrawObject(fvg.tag);
                                                RemoveDrawObject(fvg.tag + "_CE");
                            
                                                if (!HideFilledGaps)
                                                {
                                                    Brush BorderBrush = fvg.type == FVGType.R ? DownBrush : UpBrush;
                                                    rect = Draw.Rectangle(this, "FILLED" + fvg.tag, false, fvg.gapStartTime, fvg.lowerPrice, Times[1][0], fvg.upperPrice, BorderBrush, FillBrush, FilledAreaOpacity, true);
                                                    rect.OutlineStroke.Opacity = Math.Min(100, FilledAreaOpacity * 4);
                                                }
                                            }
                                            if (HideFilledGaps)
                                            {
                                                fvgList.Remove(fvg);
                                            }
                                        }
                                    }​

                            Comment


                              #59
                              Originally posted by dj22522 View Post
                              gemify and tickets2themoon

                              As an aside and just thinking out loud:-
                              You can only execute AddDataSeries during configure State of the indicator. So there is not a quicker method to modify that series that editing the indicator settings.

                              You could add a checkbox for enabling the secondary data series. If disabled you would use primary data series. This option would toggle an integer "iDataSeries" from 0 to 1 which could be used in references to time or price data.(ie. Times[1][0] would change to Times[iDataSeries][0], Closes[iDataSeries][0], etc.

                              That should work.


                              After more thought it may be possible to add a static object that when clicked switched FVGs between primary and secondary data series...
                              Last edited by tickets2themoon; 03-01-2023, 10:24 AM.

                              Comment


                                #60
                                tickets2themoon. Thank you for the code in post 58.

                                I will try that tomorrow to see if and how it might affect the resources.

                                I'm using the NT Utilization Monitor and compare an indicator to the NT Candlestick Chart Style to gauge how intensive an indicators use is.

                                Anything that remains below the CandleStick Chart Style is, as far as I understand this, a good measure of how well it's scripts been written.


                                For todays session of approx 8 hours use the NT CandleStick Chart Style used 279,000 compared to the ICTFVG v0.0.2.2 which used 4,360. I had the indicator loaded twice on each of 4 charts (tabs) but I think the utilization refers to only when any (one) chart is active.

                                So the ICTFVG is extremely efficient. All credit to it's creator.

                                I'll change the code as per post 58 and post those Utilization numbers tomorrow for comparison.

                                Hope this helps.
                                Last edited by dj22522; 03-02-2023, 04:01 AM.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by ETFVoyageur, Today, 04:00 PM
                                2 responses
                                17 views
                                0 likes
                                Last Post ETFVoyageur  
                                Started by dward123, 01-02-2024, 09:59 PM
                                3 responses
                                168 views
                                0 likes
                                Last Post bjunaid
                                by bjunaid
                                 
                                Started by AaronKTradingForum, Today, 03:44 PM
                                1 response
                                8 views
                                0 likes
                                Last Post AaronKTradingForum  
                                Started by Felix Reichert, 04-26-2024, 02:12 PM
                                11 responses
                                80 views
                                0 likes
                                Last Post Felix Reichert  
                                Started by junkone, 04-28-2024, 02:19 PM
                                7 responses
                                83 views
                                1 like
                                Last Post junkone
                                by junkone
                                 
                                Working...
                                X