BB Squeeze 1 by krog
4597 downloads / 5874 views / Created: 23.05.2013




Average Rating: 0
Indicator Description
How about this version -- here's a screenshot -- it is for the bar when fire changes from on to off. It allows long or short entries.
"Fire changes from on to off":
- only in the bar of change; subsequent off bars are no change thus disallowed
"Fire is off":
- in the bar of change, and subsequent bars (eg, fire is off)
In the screenshot, it shows the expected behavior for "Fire changes from off to on", meaning allow only on the bar of change.
Let me know if this was what you were hoping for, or if not try to describe what it should be. Sorry if this takes a few attempts, and thanks for your patience -- it takes a few iterations and examples to get the request as intended.

Forum link: BBsqueeze indicator
"Fire changes from on to off":
- only in the bar of change; subsequent off bars are no change thus disallowed
"Fire is off":
- in the bar of change, and subsequent bars (eg, fire is off)
In the screenshot, it shows the expected behavior for "Fire changes from off to on", meaning allow only on the bar of change.
Let me know if this was what you were hoping for, or if not try to describe what it should be. Sorry if this takes a few attempts, and thanks for your patience -- it takes a few iterations and examples to get the request as intended.

Forum link: BBsqueeze indicator
Comments
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604
//==============================================================
// Forex Strategy Builder
// Copyright � Miroslav Popov. All rights reserved.
//==============================================================
// THIS CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE.
//==============================================================
using System;
using System.Drawing;
using ForexStrategyBuilder.Infrastructure.Entities;
using ForexStrategyBuilder.Infrastructure.Enums;
using ForexStrategyBuilder.Infrastructure.Interfaces;
namespace ForexStrategyBuilder.Indicators.Store
{
///
/// BB Squeeze Indicator
/// from metastock indicator
/// compare bollinger bands and keltner channels with linear regression
///
public class BBSqueeze : Indicator
{
public BBSqueeze()
{
IndicatorName = "BB Squeeze";
PossibleSlots =SlotTypes.OpenFilter | SlotTypes.CloseFilter;
SeparatedChart = true;
IndicatorAuthor = "Krog";
IndicatorVersion = "2.0";
IndicatorDescription = "A custom indicator for FSB and FST.";
}
public override void Initialize(SlotTypes slotType)
{
SlotType = slotType;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new string[]
{
"Fire changes from on to off",
"Fire changes from off to on",
"The BB Squeeze is higher than the level line and Fire is on",
"The BB Squeeze is higher than the level line and Fire is off",
"The BB Squeeze is lower than the level line and Fire is on",
"The BB Squeeze is lower than the level line and Fire is off",
"The BB Squeeze is higher than the level line",
"The BB Squeeze is lower than the level line",
"The BB Squeeze rises and Fire is on",
"The BB Squeeze rises and Fire is off",
"The BB Squeeze falls and Fire is on",
"The BB Squeeze falls and Fire is off",
"The BB Squeeze rises",
"The BB Squeeze falls",
"Fire is on",
"Fire is off",
"Draw only, no Entry or Exit signals"
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Logic of application of the indicator.";
// The NumericUpDown parameters
IndParam.NumParam[0].Caption = "Bollinger Period";
IndParam.NumParam[0].Value = 10;
IndParam.NumParam[0].Min = 1;
IndParam.NumParam[0].Max = 200;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "Period of the Bollinger Band in indicator.";
IndParam.NumParam[1].Caption = "Bollinger Multiplier";
IndParam.NumParam[1].Value = 2;
IndParam.NumParam[1].Min = 1;
IndParam.NumParam[1].Max = 5;
IndParam.NumParam[1].Point = 1;
IndParam.NumParam[1].Enabled = true;
IndParam.NumParam[1].ToolTip = "Determines the width of Bollinger Bands.";
IndParam.NumParam[2].Caption = "Keltner Period";
IndParam.NumParam[2].Value = 20;
IndParam.NumParam[2].Min = 1;
IndParam.NumParam[2].Max = 200;
IndParam.NumParam[2].Enabled = true;
IndParam.NumParam[2].ToolTip = "Period of the Keltner Channel in indicator.";
IndParam.NumParam[3].Caption = "Keltner Multiplier";
IndParam.NumParam[3].Value = 1.5;
IndParam.NumParam[3].Min = 1;
IndParam.NumParam[3].Max = 10;
IndParam.NumParam[3].Point = 1;
IndParam.NumParam[3].Enabled = true;
IndParam.NumParam[3].ToolTip = "Average True Range Multiplier for the Keltner Channel.";
IndParam.NumParam[4].Caption = "Level";
IndParam.NumParam[4].Value = 0;
IndParam.NumParam[4].Min = 0;
IndParam.NumParam[4].Max = 100;
IndParam.NumParam[4].Point = 0;
IndParam.NumParam[4].Enabled = true;
IndParam.NumParam[4].ToolTip = "Level Line for BB Squeeze Histogram.";
IndParam.NumParam[5].Caption = "Fire Line";
IndParam.NumParam[5].Value = 15;
IndParam.NumParam[5].Min = 1;
IndParam.NumParam[5].Max = 30;
IndParam.NumParam[5].Point = 0;
IndParam.NumParam[5].Enabled = true;
IndParam.NumParam[5].ToolTip = "Adjust height of Fire Line in Separated Chart. \nTo help make visible only, does not affect signals.";
// The CheckBox parameters
IndParam.CheckParam[0].Caption = "Use previous bar value";
IndParam.CheckParam[0].Enabled = true;
IndParam.CheckParam[0].ToolTip = "Use the indicator value from the previous bar.";
}
public override void Calculate(IDataSet dataSet)
{
DataSet = dataSet;
// Reading the parameters
int iBollPrd = (int)IndParam.NumParam[0].Value;
double dBollMult = IndParam.NumParam[1].Value;
int iKeltPrd = (int)IndParam.NumParam[2].Value;
double dKeltMult = IndParam.NumParam[3].Value;
double dLevel = IndParam.NumParam[4].Value * Point;
double dFireLine = IndParam.NumParam[5].Value * Point;
int iPrvs = IndParam.CheckParam[0].Checked ? 1 : 0;
// Calculation
int iFirstBar = Math.Max (iBollPrd*2, iKeltPrd) + 1;
double[] adRegr = new double[Bars];
double[] adAtr = new double[Bars];
double[] adMA_Boll = new double[Bars];
double[] adStd = new double[Bars];
double[] adFire = new double[Bars];
adMA_Boll = MovingAverage(iBollPrd, 0, MAMethod.Exponential, Close);
// Get ATR and StandardDeviation values -- used in original MT4 indicator
var Atr = new AverageTrueRange();
Atr.Initialize(SlotTypes.OpenFilter);
Atr.IndParam.NumParam[0].Value = iKeltPrd;
Atr.Calculate(DataSet);
adAtr = Atr.Component[0].Value;
var StdDev = new StandardDeviation();
StdDev.Initialize(SlotTypes.OpenFilter);
StdDev.IndParam.NumParam[0].Value = iBollPrd;
StdDev.Calculate(DataSet);
adStd = StdDev.Component[0].Value;
// fill Linear Regression values, not built in indicator
// ported from MQ 4 code
// these values remains constant, get outside for loop for performance
double SumBars = 0;
double SumSqrBars = 0;
SumBars = iBollPrd * (iBollPrd-1) * 0.5;
SumSqrBars = (iBollPrd - 1) * iBollPrd * (2 * iBollPrd - 1)/6;
double Num2 = SumBars * SumBars-iBollPrd * SumSqrBars;
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
double SumY = 0;
double Sum1 = 0;
double Sum2 = 0;
double Slope = 0;
for (int x = 0; x < iBollPrd; x++) {
double HH = double.MinValue;
double LL = double.MaxValue;
for (int y = x; y < x+iBollPrd; y++)
{
HH = Math.Max(HH, High[iBar-y]);
LL = Math.Min(LL, Low[iBar-y]);
}
double dSumsBegin = (Close[iBar-x]-((HH+LL)/2 + adMA_Boll[iBar-x])/2);
Sum1 += x* dSumsBegin;
SumY += dSumsBegin;
}
Sum2 = SumBars * SumY;
double Num1 = iBollPrd * Sum1 - Sum2;
if (Num2 != 0.0) {
Slope = Num1/Num2;
} else {
Slope = 0;
}
double Intercept = (SumY - Slope*SumBars) /iBollPrd;
adRegr[iBar] = Intercept + Slope * (iBollPrd-1);
double diff = adAtr[iBar] * dKeltMult;
double std = adStd[iBar];
double bbs = (dBollMult * std) / diff;
if (bbs < 1)
{
adFire[iBar] = -dFireLine;
}
else {
adFire[iBar] = dFireLine;
}
}
// Saving the components
Component = new IndicatorComp[4];
Component[0] = new IndicatorComp();
Component[0].CompName = "BB Squeeze";
Component[0].DataType = IndComponentType.IndicatorValue;
Component[0].ChartType = IndChartType.Histogram;
Component[0].FirstBar = iFirstBar;
Component[0].Value = adRegr;
Component[1] = new IndicatorComp();
Component[1].CompName = "Fire";
Component[1].DataType = IndComponentType.IndicatorValue;
Component[1].ChartType = IndChartType.Line;
Component[1].ChartColor = Color.Blue;
Component[1].FirstBar = iFirstBar;
Component[1].Value = adFire;
Component[2] = new IndicatorComp();
Component[2].ChartType = IndChartType.NoChart;
Component[2].FirstBar = iFirstBar;
Component[2].Value = new double[Bars];
Component[3] = new IndicatorComp();
Component[3].ChartType = IndChartType.NoChart;
Component[3].FirstBar = iFirstBar;
Component[3].Value = new double[Bars];
// Sets the Component's type
if (SlotType == SlotTypes.OpenFilter)
{
Component[2].DataType = IndComponentType.AllowOpenLong;
Component[2].CompName = "Is long entry allowed";
Component[3].DataType = IndComponentType.AllowOpenShort;
Component[3].CompName = "Is short entry allowed";
}
else if (SlotType == SlotTypes.CloseFilter)
{
Component[2].DataType = IndComponentType.ForceCloseLong;
Component[2].CompName = "Close out long position";
Component[3].DataType = IndComponentType.ForceCloseShort;
Component[3].CompName = "Close out short position";
}
if (SlotType == SlotTypes.OpenFilter || SlotType == SlotTypes.CloseFilter) {
// Calculation of the logic
IndicatorLogic indLogic = IndicatorLogic.It_does_not_act_as_a_filter;
// placeholder components for storing long / short values
IndicatorComp icBBLong = new IndicatorComp();
IndicatorComp icBBShort = new IndicatorComp();
IndicatorComp icFire = new IndicatorComp();
switch (IndParam.ListParam[0].Text)
{
case "The BB Squeeze is higher than the level line and Fire is on":
icBBLong.Value = new double[Bars];
icBBShort.Value = new double[Bars];
icFire.Value = new double[Bars];
OscillatorLogic(iFirstBar, iPrvs, adRegr, dLevel, -dLevel, ref icBBLong, ref icBBShort, IndicatorLogic.The_indicator_is_higher_than_the_level_line);
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref icFire, IndicatorLogic.The_indicator_is_higher_than_the_level_line);
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
Component[2].Value[iBar] = (icBBLong.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
Component[3].Value[iBar] = (icBBShort.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
}
if (dLevel != 0) {
SpecialValues = new double[2] { dLevel, -dLevel };
}
break;
case "The BB Squeeze is higher than the level line and Fire is off":
icBBLong.Value = new double[Bars];
icBBShort.Value = new double[Bars];
icFire.Value = new double[Bars];
OscillatorLogic(iFirstBar, iPrvs, adRegr, dLevel, -dLevel, ref icBBLong, ref icBBShort, IndicatorLogic.The_indicator_is_higher_than_the_level_line);
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref icFire, IndicatorLogic.The_indicator_is_lower_than_the_level_line);
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
Component[2].Value[iBar] = (icBBLong.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
Component[3].Value[iBar] = (icBBShort.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
}
if (dLevel != 0) {
SpecialValues = new double[2] { dLevel, -dLevel };
}
break;
case "The BB Squeeze is lower than the level line and Fire is on":
icBBLong.Value = new double[Bars];
icBBShort.Value = new double[Bars];
icFire.Value = new double[Bars];
OscillatorLogic(iFirstBar, iPrvs, adRegr, dLevel, -dLevel, ref icBBLong, ref icBBShort, IndicatorLogic.The_indicator_is_lower_than_the_level_line);
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref icFire, IndicatorLogic.The_indicator_is_higher_than_the_level_line);
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
Component[2].Value[iBar] = (icBBLong.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
Component[3].Value[iBar] = (icBBShort.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
}
if (dLevel != 0) {
SpecialValues = new double[2] { dLevel, -dLevel };
}
break;
case "The BB Squeeze is lower than the level line and Fire is off":
icBBLong.Value = new double[Bars];
icBBShort.Value = new double[Bars];
icFire.Value = new double[Bars];
OscillatorLogic(iFirstBar, iPrvs, adRegr, dLevel, -dLevel, ref icBBLong, ref icBBShort, IndicatorLogic.The_indicator_is_lower_than_the_level_line);
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref icFire, IndicatorLogic.The_indicator_is_lower_than_the_level_line);
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
Component[2].Value[iBar] = (icBBLong.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
Component[3].Value[iBar] = (icBBShort.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
}
if (dLevel != 0) {
SpecialValues = new double[2] { dLevel, -dLevel };
}
break;
case "The BB Squeeze is higher than the level line":
OscillatorLogic(iFirstBar, iPrvs, adRegr, dLevel, -dLevel, ref Component[2], ref Component[3], IndicatorLogic.The_indicator_is_higher_than_the_level_line);
if (dLevel != 0) {
SpecialValues = new double[2] { dLevel, -dLevel };
}
break;
case "The BB Squeeze is lower than the level line":
OscillatorLogic(iFirstBar, iPrvs, adRegr, dLevel, -dLevel, ref Component[2], ref Component[3], IndicatorLogic.The_indicator_is_lower_than_the_level_line);
if (dLevel != 0) {
SpecialValues = new double[2] { dLevel, -dLevel };
}
break;
case "The BB Squeeze rises and Fire is on":
icBBLong.Value = new double[Bars];
icBBShort.Value = new double[Bars];
icFire.Value = new double[Bars];
OscillatorLogic(iFirstBar, iPrvs, adRegr, dLevel, -dLevel, ref icBBLong, ref icBBShort, IndicatorLogic.The_indicator_rises);
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref icFire, IndicatorLogic.The_indicator_is_higher_than_the_level_line);
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
Component[2].Value[iBar] = (icBBLong.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
Component[3].Value[iBar] = (icBBShort.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
}
if (dLevel != 0) {
SpecialValues = new double[2] { dLevel, -dLevel };
}
break;
case "The BB Squeeze rises and Fire is off":
icBBLong.Value = new double[Bars];
icBBShort.Value = new double[Bars];
icFire.Value = new double[Bars];
OscillatorLogic(iFirstBar, iPrvs, adRegr, dLevel, -dLevel, ref icBBLong, ref icBBShort, IndicatorLogic.The_indicator_rises);
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref icFire, IndicatorLogic.The_indicator_is_lower_than_the_level_line);
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
Component[2].Value[iBar] = (icBBLong.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
Component[3].Value[iBar] = (icBBShort.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
}
if (dLevel != 0) {
SpecialValues = new double[2] { dLevel, -dLevel };
}
break;
case "The BB Squeeze falls and Fire is on":
icBBLong.Value = new double[Bars];
icBBShort.Value = new double[Bars];
icFire.Value = new double[Bars];
OscillatorLogic(iFirstBar, iPrvs, adRegr, dLevel, -dLevel, ref icBBLong, ref icBBShort, IndicatorLogic.The_indicator_falls);
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref icFire, IndicatorLogic.The_indicator_is_higher_than_the_level_line);
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
Component[2].Value[iBar] = (icBBLong.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
Component[3].Value[iBar] = (icBBShort.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
}
if (dLevel != 0) {
SpecialValues = new double[2] { dLevel, -dLevel };
}
break;
case "The BB Squeeze falls and Fire is off":
icBBLong.Value = new double[Bars];
icBBShort.Value = new double[Bars];
icFire.Value = new double[Bars];
OscillatorLogic(iFirstBar, iPrvs, adRegr, dLevel, -dLevel, ref icBBLong, ref icBBShort, IndicatorLogic.The_indicator_falls);
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref icFire, IndicatorLogic.The_indicator_is_lower_than_the_level_line);
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
Component[2].Value[iBar] = (icBBLong.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
Component[3].Value[iBar] = (icBBShort.Value[iBar] == 1 && icFire.Value[iBar] == 1) ? 1.0 : 0.0;
}
if (dLevel != 0) {
SpecialValues = new double[2] { dLevel, -dLevel };
}
break;
case "The BB Squeeze rises":
OscillatorLogic(iFirstBar, iPrvs, adRegr, 0, 0, ref Component[2], ref Component[3], IndicatorLogic.The_indicator_rises);
break;
case "The BB Squeeze falls":
OscillatorLogic(iFirstBar, iPrvs, adRegr, 0, 0, ref Component[2], ref Component[3], IndicatorLogic.The_indicator_falls);
break;
case "Fire is on":
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref Component[2], IndicatorLogic.The_indicator_is_higher_than_the_level_line);
Component[3].Value = Component[2].Value;
break;
case "Fire is off":
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref Component[2], IndicatorLogic.The_indicator_is_lower_than_the_level_line);
Component[3].Value = Component[2].Value;
break;
case "Fire changes from on to off":
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref Component[2], IndicatorLogic.The_indicator_crosses_the_level_line_downward);
Component[3].Value = Component[2].Value;
break;
case "Fire changes from off to on":
NoDirectionOscillatorLogic(iFirstBar, iPrvs, adFire, 0, ref Component[2], IndicatorLogic.The_indicator_crosses_the_level_line_upward);
Component[3].Value = Component[2].Value;
break;
case "Draw only, no Entry or Exit signals":
Component[2].DataType = IndComponentType.NotDefined;
Component[2].CompName = "Visual Only";
Component[3].DataType = IndComponentType.NotDefined;
Component[3].CompName = "Visual Only";
break;
}
OscillatorLogic(iFirstBar, iPrvs, adRegr, 0, 0, ref Component[2], ref Component[3], indLogic);
}
}
public override void SetDescription()
{
int nBars = (int) IndParam.NumParam[0].Value;
string sLevelLong = IndParam.NumParam[1].ValueToString;
string sLevelShort = "-" + sLevelLong;
EntryFilterLongDescription = "the " + ToString() + " ";
EntryFilterShortDescription = "the " + ToString() + " ";
ExitFilterLongDescription = "the " + ToString() + " ";
ExitFilterShortDescription = "the " + ToString() + " ";
switch (IndParam.ListParam[0].Text)
{
case "The BB Squeeze is higher than the level line and Fire is on":
EntryFilterLongDescription += "is higher than " + sLevelLong + " and Fire is on";
EntryFilterShortDescription += "is lower than " + sLevelShort + " and Fire is on";
ExitFilterLongDescription += "is higher than " + sLevelLong + " and Fire is on";
ExitFilterShortDescription += "is lower than " + sLevelShort + " and Fire is on";
break;
case "The BB Squeeze is higher than the level line and Fire is off":
EntryFilterLongDescription += "is higher than " + sLevelLong + " and Fire is off";
EntryFilterShortDescription += "is lower than " + sLevelShort + " and Fire is off";
ExitFilterLongDescription += "is higher than " + sLevelLong + " and Fire is off";
ExitFilterShortDescription += "is lower than " + sLevelShort + " and Fire is off";
break;
case "The BB Squeeze is lower than the level line and Fire is on":
EntryFilterLongDescription += "is lower than " + sLevelLong + " and Fire is on";
EntryFilterShortDescription += "is higher than " + sLevelShort + " and Fire is on";
ExitFilterLongDescription += "is lower than " + sLevelLong + " and Fire is on";
ExitFilterShortDescription += "is higher than " + sLevelShort + " and Fire is on";
break;
case "The BB Squeeze is lower than the level line and Fire is off":
EntryFilterLongDescription += "is lower than " + sLevelLong + " and Fire is off";
EntryFilterShortDescription += "is higher than " + sLevelShort + " and Fire is off";
ExitFilterLongDescription += "is lower than " + sLevelLong + " and Fire is off";
ExitFilterShortDescription += "is higher than " + sLevelShort + " and Fire is off";
break;
case "The BB Squeeze is higher than the level line":
EntryFilterLongDescription += "is higher than " + sLevelLong;
EntryFilterShortDescription += "is lower than " + sLevelShort;
ExitFilterLongDescription += "is higher than " + sLevelLong;
ExitFilterShortDescription += "is lower than " + sLevelShort;
break;
case "The BB Squeeze is lower than the level line":
EntryFilterLongDescription += "is lower than " + sLevelLong;
EntryFilterShortDescription += "is higher than " + sLevelShort;
ExitFilterLongDescription += "is lower than " + sLevelLong;
ExitFilterShortDescription += "is higher than " + sLevelShort;
break;
case "The BB Squeeze rises and Fire is on":
EntryFilterLongDescription += "rises" + " and Fire is on";
EntryFilterShortDescription += "falls" + " and Fire is on";
ExitFilterLongDescription += "rises" + " and Fire is on";
ExitFilterShortDescription += "falls" + " and Fire is on";
break;
case "The BB Squeeze rises and Fire is off":
EntryFilterLongDescription += "rises" + " and Fire is off";
EntryFilterShortDescription += "falls" + " and Fire is off";
ExitFilterLongDescription += "rises" + " and Fire is off";
ExitFilterShortDescription += "falls" + " and Fire is off";
break;
case "The BB Squeeze falls and Fire is on":
EntryFilterLongDescription += "falls"+ " and Fire is on";
EntryFilterShortDescription += "rises"+ " and Fire is on";
ExitFilterLongDescription += "falls"+ " and Fire is on";
ExitFilterShortDescription += "rises"+ " and Fire is on";
break;
case "The BB Squeeze falls and Fire is off":
EntryFilterLongDescription += "falls" + " and Fire is off";
EntryFilterShortDescription += "rises" + " and Fire is off";
ExitFilterLongDescription += "falls" + " and Fire is off";
ExitFilterShortDescription += "rises" + " and Fire is off";
break;
case "The BB Squeeze rises":
EntryFilterLongDescription += "rises";
EntryFilterShortDescription += "falls";
ExitFilterLongDescription += "rises";
ExitFilterShortDescription += "falls";
break;
case "The BB Squeeze falls":
EntryFilterLongDescription += "falls";
EntryFilterShortDescription += "rises";
ExitFilterLongDescription += "falls";
ExitFilterShortDescription += "rises";
break;
case "Fire is on":
EntryFilterLongDescription += "Fire is on";
EntryFilterShortDescription += "Fire is on";
ExitFilterLongDescription += "Fire is on";
ExitFilterShortDescription += "Fire is on";
break;
case "Fire is off":
EntryFilterLongDescription += "Fire is off";
EntryFilterShortDescription += "Fire is off";
ExitFilterLongDescription += "Fire is off";
ExitFilterShortDescription += "Fire is off";
break;
case "Fire changes from on to off":
EntryFilterLongDescription += "Fire changes from on to off";
EntryFilterShortDescription += "Fire changes from on to off";
ExitFilterLongDescription += "Fire changes from on to off";
ExitFilterShortDescription += "Fire changes from on to off";
break;
case "Fire changes from off to on":
EntryFilterLongDescription += "Fire changes from off to on";
EntryFilterShortDescription += "Fire changes from off to on";
ExitFilterLongDescription += "Fire changes from off to on";
ExitFilterShortDescription += "Fire changes from off to on";
break;
case "Draw only, no Entry or Exit signals":
EntryFilterLongDescription = "Draw only, no Entry or Exit signals";
EntryFilterShortDescription = "Draw only, no Entry or Exit signals";
ExitFilterLongDescription = "Draw only, no Entry or Exit signals";
ExitFilterShortDescription = "Draw only, no Entry or Exit signals";
break;
}
}
public override string ToString()
{
string sString = IndicatorName +
(IndParam.CheckParam[0].Checked ? "* (" : " (") +
"Boll n=" + IndParam.NumParam[0].ValueToString + ", " + // Bollinger period
"mult=" + IndParam.NumParam[1].ValueToString + ", " + // Bollinger Multiplier
"Kelt n="+ IndParam.NumParam[2].ValueToString + "," + // Keltner Period
"mult="+ IndParam.NumParam[3].ValueToString + "," + // Keltner Multiplier
"level="+ IndParam.NumParam[4].ValueToString + ")"; // level
return sString;
}
}
}
Risk warning: Forex, spread bets and CFD are leveraged products. They may not be suitable for you as they carry a high degree of risk to your capital and you can lose more than your initial investment. You should ensure you understand all of the risks.
Copyright © 2006 - 2025, Forex Software Ltd.;
Copyright © 2006 - 2025, Forex Software Ltd.;