예제 #1
0
 private void checkBrokenLevels(JBTPOProfile profile)
 {
     foreach (JBTPOProfile each in this.tpoProfiles)
     {
         each.checkBrokenLevels(profile.getRangeLow(), profile.getRangeHigh());
     }
 }
예제 #2
0
 private void drawTPOLevels(JBTPOProfile profile)
 {
     DrayLabeledRay("HI", tpoProfile, tpoProfile.getRangeHigh(), getBrush(true, Brushes.Green));
     DrayLabeledRay("LO", tpoProfile, tpoProfile.getRangeLow(), Brushes.Red);
     DrayLabeledRay("POC", tpoProfile, tpoProfile.getPOC(), Brushes.Pink);
     DrayLabeledRay("VAH", tpoProfile, tpoProfile.getValHigh(), Brushes.White);
     DrayLabeledRay("VAL", tpoProfile, tpoProfile.getValLow(), Brushes.White);
 }
예제 #3
0
        private void update(JBTPOProfile profile)
        {
            //printIt(tpoProfile);

            tpoProfile.calculateValueArea(this);
            checkBrokenLevels(tpoProfile);
            drawTPOLevels(tpoProfile);
        }
예제 #4
0
        public void printIt(JBTPOProfile tpoProfile)
        {
            SortedDictionary <double, HashSet <double> > .KeyCollection keyColl = tpoProfile.profile.Keys;

            Print("Session at " + tpoProfile.sessionStart + " varea " + tpoProfile.valLow + " - " + tpoProfile.valHigh + " " + tpoProfile.count);
            foreach (double price in keyColl)
            {
                Print("TPO " + price + ", " + tpoProfile.profile[price].Count);
            }
        }
예제 #5
0
 private void checkBrokenLevels(JBTPOProfile profile)
 {
     foreach (JBTPOProfile each in this.tpoProfiles)
     {
         if (each != profile)
         {
             if (each.tradingHours == RTH)
             {
                 if (ShowPOC && each.checkBrokenPOC(profile.getRangeLow(), profile.getRangeHigh()))
                 {
                     DrawLabeledRay("POC", each, each.getPOC(), getBrush(true, POCColor));
                 }
                 if (ShowHILO && each.checkBrokenHigh(profile.getRangeLow(), profile.getRangeHigh()))
                 {
                     DrawLabeledRay("HI", each, each.getRangeHigh(), getBrush(true, HILOColor));
                 }
                 if (ShowHILO && each.checkBrokenLow(profile.getRangeLow(), profile.getRangeHigh()))
                 {
                     DrawLabeledRay("LO", each, each.getRangeLow(), getBrush(true, HILOColor));
                 }
                 if (ShowVA && each.checkBrokenValHigh(profile.getRangeLow(), profile.getRangeHigh()))
                 {
                     DrawLabeledRay("VAH", each, each.getValHigh(), getBrush(true, VAColor));
                 }
                 if (ShowVA && each.checkBrokenValLow(profile.getRangeLow(), profile.getRangeHigh()))
                 {
                     DrawLabeledRay("VAL", each, each.getValLow(), getBrush(true, VAColor));
                 }
             }
             else
             {
                 if (ShowONPOC && each.checkBrokenPOC(profile.getRangeLow(), profile.getRangeHigh()))
                 {
                     DrawLabeledRay("ON POC", each, each.getPOC(), getBrush(true, ONPOCColor));
                 }
                 if (ShowONHILO && each.checkBrokenHigh(profile.getRangeLow(), profile.getRangeHigh()))
                 {
                     DrawLabeledRay("ON HI", each, each.getRangeHigh(), getBrush(true, ONHILOColor));
                 }
                 if (ShowONHILO && each.checkBrokenLow(profile.getRangeLow(), profile.getRangeHigh()))
                 {
                     DrawLabeledRay("ON LO", each, each.getRangeLow(), getBrush(true, ONHILOColor));
                 }
                 if (ShowONVA && each.checkBrokenValHigh(profile.getRangeLow(), profile.getRangeHigh()))
                 {
                     DrawLabeledRay("ON VAH", each, each.getValHigh(), getBrush(true, ONVAColor));
                 }
                 if (ShowONVA && each.checkBrokenValLow(profile.getRangeLow(), profile.getRangeHigh()))
                 {
                     DrawLabeledRay("ON VAL", each, each.getValLow(), getBrush(true, ONVAColor));
                 }
             }
         }
     }
 }
예제 #6
0
        private LabeledRay DrayLabeledRay(String label, JBTPOProfile profile, double price, Brush color)
        {
            LabeledRay ray = DrawLL.LabeledRay(this, profile.id + "_" + label, profile.sessionStart, price, Time[0], price, color);

            ray.DisplayText     = (profile.tradingHours == ETH ? "ON " : "") + label + " " + profile.dateString;
            ray.Font            = textFont;
            ray.AppendPriceTime = false;
            ray.IsLocked        = false;
            ray.RoundPrice      = true;

            return(ray);
        }
예제 #7
0
        private LabeledRay DrawLabeledRay(String label, JBTPOProfile profile, double price, Brush color)
        {
            RemoveDrawObject(profile.id + "_" + label);

            LabeledRay ray = DrawLL.LabeledRay(this, profile.id + "_" + label, profile.sessionStart, price, Time[0], price, color, LineStyle, LineWidth);

            ray.DisplayText     = label + " " + profile.dateString;
            ray.Font            = LabelFont;
            ray.AppendPriceTime = false;
            ray.IsLocked        = false;
            ray.RoundPrice      = true;

            return(ray);
        }
예제 #8
0
 private void drawTPOLevels(JBTPOProfile profile)
 {
     if (profile.tradingHours == RTH)
     {
         if (ShowHILO)
         {
             DrawLabeledRay("HI", tpoProfile, tpoProfile.getRangeHigh(), getBrush(profile.highBroken, HILOColor));
             DrawLabeledRay("LO", tpoProfile, tpoProfile.getRangeLow(), getBrush(profile.lowBroken, HILOColor));
         }
         if (ShowPOC)
         {
             DrawLabeledRay("POC", tpoProfile, tpoProfile.getPOC(), getBrush(profile.pocBroken, POCColor));
         }
         if (ShowVA)
         {
             DrawLabeledRay("VAH", tpoProfile, tpoProfile.getValHigh(), getBrush(profile.valHighBroken, VAColor));
             DrawLabeledRay("VAL", tpoProfile, tpoProfile.getValLow(), getBrush(profile.valLowBroken, VAColor));
         }
     }
     else
     {
         if (ShowONHILO)
         {
             DrawLabeledRay("ON HI", tpoProfile, tpoProfile.getRangeHigh(), getBrush(profile.highBroken, ONHILOColor));
             DrawLabeledRay("ON LO", tpoProfile, tpoProfile.getRangeLow(), getBrush(profile.lowBroken, ONHILOColor));
         }
         if (ShowONPOC)
         {
             DrawLabeledRay("ON POC", tpoProfile, tpoProfile.getPOC(), getBrush(profile.pocBroken, ONPOCColor));
         }
         if (ShowONVA)
         {
             DrawLabeledRay("ON VAH", tpoProfile, tpoProfile.getValHigh(), getBrush(profile.valHighBroken, ONVAColor));
             DrawLabeledRay("ON VAL", tpoProfile, tpoProfile.getValLow(), getBrush(profile.valLowBroken, ONVAColor));
         }
     }
 }
예제 #9
0
        protected override void OnMarketData(MarketDataEventArgs e)
        {
            if (!initDone)
            {
                return;
            }
            if (e.MarketDataType == MarketDataType.Settlement && BarsInProgress == 0)
            {
                settlement = e.Price;
                if (CurrentBars[0] > 1)
                {
                    DrawSettlementRay("SETTLEM " + e.Time.ToString("MMM dd"), Times[0][1], settlement, Times[0][0], SettlementColor);
                }
                return;
            }

            if (e.MarketDataType == MarketDataType.Last)
            {
                if (isStartOfNewSessionRTH())
                {
                    // Print(e.Time+" "+BarsInProgress+" "+BarsArray[RTH].IsFirstBarOfSession);
                    if (tpoProfile != null)
                    {
                        update(tpoProfile);
                        tpoProfiles.Add(tpoProfile);
                    }
                    rthSessionIterator.GetNextSession(e.Time, false);
                    tpoProfile = new JBTPOProfile(RTH, rthSessionIterator.ActualSessionBegin, rthSessionIterator.ActualSessionEnd);
                    // Print("SESSION - "+tpoProfile.sessionStart+" - "+tpoProfile.sessionEnd);
                }
                if (isStartOfNewSessionETH())
                {
                    //Print(e.Time+" "+BarsInProgress+" "+BarsArray[ETH].IsFirstBarOfSession);
                    if (tpoProfile != null)
                    {
                        update(tpoProfile);
                        tpoProfiles.Add(tpoProfile);
                    }
                    ethSessionIterator.GetNextSession(e.Time, false);
                    tpoProfile = new JBTPOProfile(ETH, ethSessionIterator.ActualSessionBegin, ethSessionIterator.ActualSessionEnd);
                    // Print("SESSION - "+tpoProfile.sessionStart+" - "+tpoProfile.sessionEnd);
                }

                if (BarsInProgress == RTH && CurrentBars[RTH] != activeBarRTH)
                {
                    tpoId        = (Times[RTH][0] - tpoProfile.sessionStart).TotalSeconds;
                    activeBarRTH = CurrentBars[RTH];
                }
                else if (BarsInProgress == ETH && CurrentBars[ETH] != activeBarETH)
                {
                    tpoId        = (Times[ETH][0] - tpoProfile.sessionStart).TotalSeconds;
                    activeBarETH = CurrentBars[ETH];
                }
                if ((BarsInProgress == RTH || BarsInProgress == ETH) && tpoProfile != null)
                {
                    //Print(e.Time+" "+e.Price);
                    if (e.Time >= tpoProfile.sessionStart && e.Time < tpoProfile.sessionEnd)
                    {
                        tpoProfile.add(e.Price, tpoId);
                    }
                }
                else if (BarsInProgress == 0 && CurrentBars[0] != activeBar)
                {
                    if (tpoProfile != null)
                    {
                        update(tpoProfile);
                    }
                    activeBar = CurrentBars[0];
                }
            }
        }
예제 #10
0
        protected override void OnBarUpdate()
        {
            //Print(Times[BarsInProgress][0]+" "+BarsInProgress);
            if (isStartOfNewSessionRTH())
            {
                //Print("RTH "+Times[RTH][0]);

                //Print(Times[BarsInProgress][0]+" "+BarsInProgress);
                //Print(Times[ETH][0]+" session: "+ethSessionIterator.ActualSessionBegin+"  "+CurrentBars[ETH]);

                rthSessionIterator.GetNextSession(Times[RTH][0], false);

                if (tpoProfile != null)
                {
                    update(tpoProfile);
                    tpoProfiles.Add(tpoProfile);
                }
                tpoProfile = new JBTPOProfile(RTH, rthSessionIterator.ActualSessionBegin);
            }
            else if (isStartOfNewSessionETH())
            {
                //Print("ETH "+Times[ETH][0]);

                //Print(Times[BarsInProgress][0]+" "+BarsInProgress);
                //Print(Times[ETH][0]+" session: "+ethSessionIterator.ActualSessionBegin+"  "+CurrentBars[ETH]);

                ethSessionIterator.GetNextSession(Times[ETH][0], false);

                if (tpoProfile != null)
                {
                    update(tpoProfile);
                    tpoProfiles.Add(tpoProfile);
                }

                tpoProfile = new JBTPOProfile(ETH, ethSessionIterator.ActualSessionBegin);
            }

            if (BarsInProgress == RTH && CurrentBars[RTH] != activeBarRTH)
            {
                if (tpoProfile != null)
                {
                    if (State == State.Realtime)
                    {
                        update(tpoProfile);
                    }
                    tpoId = (Times[RTH][0] - tpoProfile.sessionStart).TotalSeconds;
                }
                activeBarRTH = CurrentBars[RTH];
                //Print("RTH TPO ID "+Times[RTH][0]+" "+rthTPOId);
            }
            else if (BarsInProgress == ETH && CurrentBars[ETH] != activeBarETH)
            {
                if (tpoProfile != null)
                {
                    if (State == State.Realtime)
                    {
                        update(tpoProfile);
                    }
                    tpoId = (Times[ETH][0] - tpoProfile.sessionStart).TotalSeconds;
                }
                activeBarETH = CurrentBars[ETH];
                //Print("ETH TPO ID "+Times[ETH][0]+" "+rthTPOId);
            }


            if (tpoProfile != null)
            {
                tpoProfile.add(Closes[BarsInProgress][0], tpoId);
            }
        }