Changes.
The Mean, E207 on the hourly translates vaguely to a 9EMA HL2 on the daily.

Since the mean was crossed over, closed over, so the odds favor a move back to the lower Keltinger Band, and I would no longer deem this rally a bear market rally. What is likely to happen here is a 20-50 pips pullback, so I would try to dump my shorts. If the next daily closes below the 9 EMA, a downside continuation would become more probable.
I put back the directional filter for the fizzle condition. I thought the red block was a mistake, but in fact it was right for postponing the climax. I don’t even remember what condition I had to flip it back to green up here, but it was certainly right. Wait, it had to be clearing the mean. One of these four…
//E207 leave down
if (High[i]-Low[i]>280*Point && High[i]>iMA(NULL,0,207,0,MODE_EMA, PRICE_LOW,i) && Low[i]<iMA(NULL,0,207,0,MODE_EMA, PRICE_LOW,i) && Close[i]<Open[i] && iMA(NULL,0,207,0,MODE_EMA, PRICE_MEDIAN,i)-iMA(NULL,0,67,0,MODE_EMA, PRICE_MEDIAN,i)<160*Point) dir[i]=-1;
//E207 leave down reprise
else if (High[i]>iMA(NULL,0,207,0,MODE_EMA, PRICE_LOW,i) && Low[i]<iMA(NULL,0,207,0,MODE_EMA, PRICE_LOW,i) && Close[i]<Open[i] && iMA(NULL,0,207,0,MODE_EMA, PRICE_MEDIAN,i)-iMA(NULL,0,67,0,MODE_EMA, PRICE_MEDIAN,i)<160*Point && dir[i]==-1) dir[i]=1;
//High[i]-Low[i]>280*Point &&
//E207 leave up
if (High[i]-Low[i]>280*Point && High[i]>iMA(NULL,0,207,0,MODE_EMA, PRICE_HIGH,i) && Low[i]<iMA(NULL,0,207,0,MODE_EMA, PRICE_HIGH,i) && Close[i]>Open[i]) dir[i]=1;
//E207 leave up reprise
else if ( High[i]-Low[i]>280*Point && High[i]>iMA(NULL,0,207,0,MODE_EMA, PRICE_HIGH,i) && Low[i]<iMA(NULL,0,207,0,MODE_EMA, PRICE_HIGH,i) && Close[i]>Open[i] && dir[i]==1) dir[i]=-1;



The head is a tricky one. Since I believe that the head should be worth buying, I had to eliminate some weaker prints.

It is not as easy as looking at a lower low with an RSI2 print that does not touch the zero line.
if (Close[0]<iBands(symbol,1440,44,0.8,0,PRICE_MEDIAN,MODE_LOW,0) && iFractals(symbol,0,MODE_LOWER,i)
&& ExtMapBuffer2[i]==EMPTY_VALUE && RSI2[i]>4
&& RSI2[ArrayMaximum(RSI2,26,i)]>88
&& RSI2[ArrayMinimum(RSI2,2,i+1)]>1
&& Low[i]<iLow(symbol,0,iLowest(symbol,0,MODE_LOW,24,i+1))
){
Where ExtMapuffer2 is the array for the Hybrid Stochastic Overdrives Down.
A small modification was done to the 15-Min ATR routine by adding a 3rd 20-pip box and a “C”.

I can no longer attach Zip files on this blog (attaching an ex4 was never a possibility), so my options are either my Google One Drive or including a source code.
//15 MIN ATR TARGET PRO
#property copyright "Copyright © 2018, Macdulio"
#property link "forexfore.blog"
#property description "15-MIN ATR TARGETS PRO"
#property description "The arrow is the last 15-MIN consolidation weight"
#property description "The two aiming signals are the"
#property description "approximate area of a projected limit to a move on a normal day"
#property description "The projection lines are based om current 30-min MACD (24,52,5) bias"
#property description "and for better visuals plotted from the last high/low RSI print"
#property description "the program can plot a mesh with adjustable pip values"
#property description "plot qualifying moves, and has Fibonacci options"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 DeepSkyBlue
#property indicator_color2 Pink
#property indicator_color3 DarkGreen
#property indicator_color4 Crimson
//--- buffers
double vbru[];
double ATRA;
double ATRAVG[];
double weight;
double fhigh;
double flow;
double w[];
double ut[];
double dt[];
double BighBuffer;
double BowBuffer;
double BighBuffer2;
double BowBuffer2;
datetime UpFractalTime_1,LowFractalTime_1,UpFractalTime_2,LowFractalTime_2;
double mid[];
double ExtMapBuffer[];
extern int RSILOW = 15;
extern int RSIHIGH = 85;
extern bool plot_numbers=true;
extern bool plot_grid_55=false;
extern bool plot_qualifying_moves=false;
extern bool plot_last_swing_fib=false;
extern bool plot_qualifying_move_fib=false;
extern double pacing=55;
extern int lookback = 24;
extern int lastbar = 0;
extern color FibColor= Navy;
//---- variables
string TimeFrame;
datetime LastAlert=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW,EMPTY,20,BlueViolet);
SetIndexBuffer(0,w);
SetIndexArrow(0,224);
SetIndexStyle(1,DRAW_ARROW,EMPTY,20,Red);
SetIndexBuffer(1,ut);
SetIndexArrow(1,177);
SetIndexStyle(2,DRAW_ARROW,EMPTY,20,Red);
SetIndexBuffer(2,dt);
SetIndexArrow(2,177);
string short_name="15 MIN ATR";
IndicatorShortName(short_name);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
// ObjectsDeleteAll();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i,i2,j,j2,k; // Bar Index
int lasti,lasti2,lastj,lastj2;
ArrayResize(ExtMapBuffer, Bars);
ArrayInitialize(ExtMapBuffer, 0);
ArrayResize(w, 2);
ArrayInitialize(w, EMPTY_VALUE);
ArrayResize(ut, 2);
ArrayInitialize(ut, EMPTY_VALUE);
ArrayResize(dt, 2);
ArrayInitialize(dt, EMPTY_VALUE);
ArrayResize(mid, Bars);
ArrayInitialize(mid, 0);
ArrayResize(vbru, Bars);
ArrayInitialize(vbru, 0);
ArrayResize(ATRAVG, 353);
ArrayInitialize(ATRAVG, 0);
int counted_bars=IndicatorCounted();
string obj_name="My_Target_Lines"+IntegerToString(i);
//--------------------------------------------------------------------
ObjectDelete("Fibo");
if (plot_last_swing_fib) {
double lowest=1000, highest=0;
datetime T1,T2;
for(i=lookback+lastbar;i>lastbar+1;i--)
{
double curLow0=iLow(Symbol(),Period(),i-2);
double curLow1=iLow(Symbol(),Period(),i+1);
double curLow2=iLow(Symbol(),Period(),i);
double curLow3=iLow(Symbol(),Period(),i-1);
double curLow4=iLow(Symbol(),Period(),i-2);
double curHigh0=iHigh(Symbol(),Period(),i+2);
double curHigh1=iHigh(Symbol(),Period(),i+1);
double curHigh2=iHigh(Symbol(),Period(),i);
double curHigh3=iHigh(Symbol(),Period(),i-1);
double curHigh4=iHigh(Symbol(),Period(),i-2);
if(curLow2<=curLow1 && curLow2<=curLow1 && curLow2<=curLow0 )
{
if(lowest>curLow2){
lowest=curLow2;
T2=iTime(Symbol(),Period(),i);}
}
if(curHigh2>=curHigh1 && curHigh2>=curHigh3&& curHigh2>=curHigh4)
{
if(highest<curHigh2){
highest=curHigh2;
T1=iTime(Symbol(),Period(),i);}
}
}
Comment(highest, lowest);
if(T1<T2)
{ObjectCreate("Fibo", OBJ_FIBO, 0, T1, highest,T2,lowest);}
else{
ObjectCreate("Fibo", OBJ_FIBO, 0, T2, lowest, T1,highest);
}
//----
string fiboobjname = "Fibo";
ObjectSet(fiboobjname, OBJPROP_FIBOLEVELS, 11);
ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL, 0.0);
ObjectSetFiboDescription(fiboobjname,0,"0.0 %$");
ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+1, 0.236);
ObjectSetFiboDescription(fiboobjname,1,"23.6 %$");
ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+2, 0.382);
ObjectSetFiboDescription(fiboobjname,2,"38.2 %$");
ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+3, 0.50);
ObjectSetFiboDescription(fiboobjname,3,"50.0 %$");
ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+4, 0.618);
ObjectSetFiboDescription(fiboobjname,4,"61.8 %$");
ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+5, 0.786);
ObjectSetFiboDescription(fiboobjname,5,"78.6 %$");
ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+6, 1.000);
ObjectSetFiboDescription(fiboobjname,6,"100.0 %$");
ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+7, -0.272);
ObjectSetFiboDescription(fiboobjname,7,"127.2 %$");
ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+8, -0.618);
ObjectSetFiboDescription(fiboobjname,8,"161.8 %$");
ObjectSet( "Fibo", OBJPROP_LEVELCOLOR, clrWhite) ;
ObjectsRedraw();
}
ATRA = 0;
for (i=1; i<=3; i++){
ATRA = ATRA+iATR(NULL,1440,14,i);}
for (i=0; i<=160; i++){
ATRAVG[i] = ATRA/3; }
i=0;
while (!(ChoppinessIndex(12*4,i+1)<53 && ChoppinessIndex(12*4,i)>53))
i++;
weight=(iHigh(NULL,15,i)+iLow(NULL,15,i))/2;
w[1]=EMPTY_VALUE;
w[0]=EMPTY_VALUE;
ut[1]=EMPTY_VALUE;
ut[0]=EMPTY_VALUE;
dt[1]=EMPTY_VALUE;
dt[0]=EMPTY_VALUE;
w[0]=weight;
ut[0]=w[0]+ATRAVG[0]*1.10;
dt[0]=w[0]-ATRAVG[0]*1.10;
BowBuffer=(iClose(NULL,15,i))-ATRAVG[i]*1.30;
BighBuffer=iClose(NULL,15,i)-ATRAVG[i];
BowBuffer2=iClose(NULL,15,i)+ATRAVG[i];
BighBuffer2=iClose(NULL,15,i)+ATRAVG[i]*1.30;
deletetxt1("ATR");
if (Close[0]<iMA(Symbol(),30,32,0,MODE_EMA,PRICE_CLOSE,0)){
ObjectCreate("ATR1", OBJ_RECTANGLE, 0, Time[10], BowBuffer, Time[0], BighBuffer);
ObjectSetInteger(0,"ATR1",OBJPROP_COLOR,clrOrange);
ObjectSet("ATR1",OBJPROP_BACK,1);
ObjectSet("ATR1",OBJPROP_WIDTH,5);
ObjectCreate("ATR11", OBJ_RECTANGLE, 0, Time[10], BighBuffer, Time[0], BighBuffer+200*Point);
ObjectSetInteger(0,"ATR11",OBJPROP_COLOR,clrGray);
ObjectSet("ATR11",OBJPROP_BACK,0);
ObjectSet("ATR11",OBJPROP_WIDTH,3);
ObjectCreate("ATR111", OBJ_RECTANGLE, 0, Time[10], BowBuffer, Time[0], BowBuffer-200*Point);
ObjectSetInteger(0,"ATR111",OBJPROP_COLOR,clrGray);
ObjectSet("ATR111",OBJPROP_BACK,0);
ObjectSet("ATR111",OBJPROP_WIDTH,3);
}
if (Close[0]>iMA(Symbol(),30,32,0,MODE_EMA,PRICE_CLOSE,0)){
ObjectCreate("ATR2", OBJ_RECTANGLE, 0, Time[10], BowBuffer2, Time[0], BighBuffer2);
ObjectSetInteger(0,"ATR2",OBJPROP_COLOR,clrOrange);
ObjectSet("ATR2",OBJPROP_BACK,1);
ObjectSet("ATR2",OBJPROP_WIDTH,5);
ObjectCreate("ATR22", OBJ_RECTANGLE, 0, Time[10], BowBuffer2-200*Point, Time[0], BowBuffer2);
ObjectSetInteger(0,"ATR22",OBJPROP_COLOR,clrGray);
ObjectSet("ATR22",OBJPROP_BACK,0);
ObjectSet("ATR22",OBJPROP_WIDTH,3);
ObjectCreate("ATR222", OBJ_RECTANGLE, 0, Time[10], BighBuffer2+200*Point, Time[0], BighBuffer2);
ObjectSetInteger(0,"ATR222",OBJPROP_COLOR,clrGray);
ObjectSet("ATR222",OBJPROP_BACK,0);
ObjectSet("ATR222",OBJPROP_WIDTH,3);
}
deletetxt1("Line9_");
j2=0;
while (j2<=300){
if (iRSI(NULL,0,2,PRICE_MEDIAN,j2+1)<RSILOW && iRSI(NULL,0,2,PRICE_MEDIAN,j2)>RSILOW ) break;
j2++;}
LowFractalTime_2=iTime(NULL, 0,j2); LowFractalTime_1=iTime(NULL, 0,0);
ObjectDelete(0,"Line9_2");
if (j2<300 && (iMACD(NULL,30,24,52,5,PRICE_MEDIAN,0,1)>iMACD(NULL,30,24,52,5,PRICE_MEDIAN,1,1) || iMACD(NULL,30,24,52,5,PRICE_MEDIAN,0,0)>iMACD(NULL,30,24,52,5,PRICE_MEDIAN,1,0) )) {
ObjectCreate(0,"Line9_2",OBJ_TREND,0,LowFractalTime_1,NormalizeDouble(w[0]+ATRAVG[0]*1.10,4),LowFractalTime_2,Low[j2]);
ObjectSetInteger(0,"Line9_2",OBJPROP_RAY_RIGHT,false);
ObjectSetInteger(0,"Line9_2",OBJPROP_BACK, true);
ObjectSet("Line9_2",OBJPROP_COLOR,indicator_color1);
ObjectSet("Line9_2",OBJPROP_WIDTH,18); }
i2=0;
while (i2<=300){
if (iRSI(NULL,0,2,PRICE_MEDIAN,i2+1)>RSIHIGH && iRSI(NULL,0,2,PRICE_MEDIAN,i2)<RSIHIGH ) break;
i2++;}
UpFractalTime_2=iTime(NULL, 0,i2); UpFractalTime_1=iTime(NULL, 0,0);
ObjectDelete(0,"Line9_1");
if (i2<300 && (iMACD(NULL,30,24,52,5,PRICE_MEDIAN,0,1)<iMACD(NULL,30,24,52,5,PRICE_MEDIAN,1,1) || iMACD(NULL,30,24,52,5,PRICE_MEDIAN,0,0)<iMACD(NULL,30,24,52,5,PRICE_MEDIAN,1,0)) ) {
ObjectCreate(0,"Line9_1",OBJ_TREND,0,UpFractalTime_1,NormalizeDouble(w[0]-ATRAVG[0]*1.10,4),UpFractalTime_2,High[i2]);
ObjectSetInteger(0,"Line9_1",OBJPROP_RAY_RIGHT,false);
ObjectSetInteger(0,"Line9_1",OBJPROP_BACK, true);
ObjectSet("Line9_1",OBJPROP_COLOR,indicator_color2);
ObjectSet("Line9_1",OBJPROP_WIDTH,18); }
deletetxt1("txt 7");
if (plot_numbers){deletetxt1("txt 7");
ObjectCreate("txt 7"+BighBuffer, OBJ_TEXT, 0, Time[4], BighBuffer+.0005);
ObjectSetText("txt 7"+BighBuffer, NormalizeDouble(BighBuffer,4), 22, "Arial Black", Blue);
ObjectCreate("txt 7"+BowBuffer, OBJ_TEXT, 0, Time[4], BowBuffer+.0005);
ObjectSetText("txt 7"+BowBuffer, NormalizeDouble(BowBuffer,4), 22, "Arial Black", Black);
ObjectCreate("txt 7"+BighBuffer2, OBJ_TEXT, 0, Time[4], BighBuffer2+.0005);
ObjectSetText("txt 7"+BighBuffer2, NormalizeDouble(BighBuffer2,4), 22, "Arial Black", Black);
ObjectCreate("txt 7"+BowBuffer2, OBJ_TEXT, 0, Time[4], BowBuffer2+.0005);
ObjectSetText("txt 7"+BowBuffer2, NormalizeDouble(BowBuffer2,4), 22, "Arial Black", Blue);
if (Close[0]<w[0]){
ObjectCreate("txt 7"+BighBuffer*BowBuffer, OBJ_TEXT, 0, Time[8], (BighBuffer+BowBuffer)/2-.0015);
ObjectSetText("txt 7"+BighBuffer*BowBuffer, "C", 22, "Impact", White);
ObjectCreate("txt 7"+BighBuffer+BowBuffer, OBJ_TEXT, 0, Time[8], (BighBuffer+BowBuffer)/2+.0005);
ObjectSetText("txt 7"+BighBuffer+BowBuffer, "W3", 22, "Impact", Crimson);
ObjectCreate("txt 7"+(BighBuffer-BowBuffer), OBJ_TEXT, 0, Time[8], BighBuffer+.0015);
ObjectSetText("txt 7"+(BighBuffer-BowBuffer), "W1<="+ NormalizeDouble(BighBuffer+.0020,4), 22, "Impact", White);
}
else {
ObjectCreate("txt 7"+BighBuffer2*BowBuffer2, OBJ_TEXT, 0, Time[8], (BighBuffer2+BowBuffer2)/2+.0025);
ObjectSetText("txt 7"+BighBuffer2*BowBuffer2, "C", 22, "Impact", White);
ObjectCreate("txt 7"+BighBuffer2+BowBuffer2, OBJ_TEXT, 0, Time[8], (BighBuffer2+BowBuffer2)/2+.0005);
ObjectSetText("txt 7"+BighBuffer2+BowBuffer2, "W3", 22, "Impact", Crimson);
ObjectCreate("txt 7"+(BighBuffer2-BowBuffer2), OBJ_TEXT, 0, Time[8], BowBuffer2-.0015);
ObjectSetText("txt 7"+(BighBuffer2-BowBuffer2), "W1>="+ NormalizeDouble(BowBuffer2-.0020,4), 22, "Impact", White);
}
}
deletetxt1("HLN");
if (plot_grid_55) {
ObjectCreate( "HLN"+IntegerToString(0), OBJ_HLINE, 0, Time[0], w[0] );
ObjectSet("HLN"+IntegerToString(0), OBJPROP_COLOR, clrBlack );
ObjectSet("HLN"+IntegerToString(0), OBJPROP_STYLE, 2 );
for (i=1; i<=3; i++) {
ObjectCreate( "HLN"+IntegerToString(i), OBJ_HLINE, 0, Time[0], NormalizeDouble(w[0]+(pacing/10000)*i,5) );
ObjectSet("HLN"+IntegerToString(i), OBJPROP_COLOR, clrBlack );
ObjectSet("HLN"+IntegerToString(i), OBJPROP_STYLE, 2 );
}
for (i=-1; i>=-3; i--) {
ObjectCreate( "HLN"+IntegerToString(i), OBJ_HLINE, 0, Time[0], NormalizeDouble(w[0]+(pacing/10000)*i,5) );
ObjectSet("HLN"+IntegerToString(i), OBJPROP_COLOR, clrBlack );
ObjectSet("HLN"+IntegerToString(i), OBJPROP_STYLE, 2 );
}
}
deletetxt1("Line8_");
if (plot_qualifying_moves) {
//deletetxt1("Line8_");
for (k=50; k>=0; k--){
j=k;
while (j<=300){
if (iFractals(NULL,0,MODE_UPPER,j)) break;
j++;}
j2=j+1;
while (j2<=j+25){
if (iFractals(NULL,0,MODE_LOWER,j2) && High[j]-Low[j2]>ATRAVG[0]*.85) break;
j2++;}
LowFractalTime_2=iTime(NULL, 0,j2); LowFractalTime_1=iTime(NULL, 0,j);
if (j2<300 && High[j]-Low[j2]>.0055 ) {
ObjectDelete(0,"Line8_2"+j);
ObjectCreate(0,"Line8_2"+j,OBJ_TREND,0,LowFractalTime_1,High[j],LowFractalTime_2,Low[j2]);
ObjectSetInteger(0,"Line8_2"+j,OBJPROP_RAY_RIGHT,false);
ObjectSetInteger(0,"Line8_2"+j,OBJPROP_BACK, true);
ObjectSet("Line8_2"+j,OBJPROP_COLOR,indicator_color3);
ObjectSet("Line8_2"+j,OBJPROP_WIDTH,18);
lastj=j;
lastj2=j2;
}
i=k;
while (i<=300){
if (iFractals(NULL,0,MODE_LOWER,i)) break;
i++;}
i2=i+1;
while (i2<=i+25){
if (iFractals(NULL,0,MODE_UPPER,i2) && High[i2]-Low[i]>ATRAVG[0]*.85) break;
i2++;}
UpFractalTime_2=iTime(NULL, 0,i2); UpFractalTime_1=iTime(NULL, 0,i);
if (i2<300 && High[i2]-Low[i]>.0055) {
ObjectDelete(0,"Line8_1"+i);
ObjectCreate(0,"Line8_1"+i,OBJ_TREND,0,UpFractalTime_1,Low[i],UpFractalTime_2,High[i2]);
ObjectSetInteger(0,"Line8_1"+i,OBJPROP_RAY_RIGHT,false);
ObjectSetInteger(0,"Line8_1"+i,OBJPROP_BACK, true);
ObjectSet("Line8_1"+i,OBJPROP_COLOR,indicator_color4);
ObjectSet("Line8_1"+i,OBJPROP_WIDTH,18);
lasti=i;
lasti2=i2;
}
}
if (plot_qualifying_move_fib){
ObjectDelete("Fibu");
if(lasti<=lastj)
{ObjectCreate("Fibu", OBJ_FIBO, 0, UpFractalTime_1, Low[lasti],UpFractalTime_2,High[lasti2]);}
else{
ObjectCreate("Fibu", OBJ_FIBO, 0, LowFractalTime_1, High[lastj], LowFractalTime_2,Low[lastj2]);}
string fiboobjname2 = "Fibu";
ObjectSet(fiboobjname2, OBJPROP_FIBOLEVELS, 11);
ObjectSet(fiboobjname2, OBJPROP_FIRSTLEVEL, 0.0);
ObjectSetFiboDescription(fiboobjname2,0,"0.0 %$");
ObjectSet(fiboobjname2, OBJPROP_FIRSTLEVEL+1, 0.236);
ObjectSetFiboDescription(fiboobjname2,1,"23.6 %$");
ObjectSet(fiboobjname2, OBJPROP_FIRSTLEVEL+2, 0.382);
ObjectSetFiboDescription(fiboobjname2,2,"38.2 %$");
ObjectSet(fiboobjname2, OBJPROP_FIRSTLEVEL+3, 0.50);
ObjectSetFiboDescription(fiboobjname2,3,"50.0 %$");
ObjectSet(fiboobjname2, OBJPROP_FIRSTLEVEL+4, 0.618);
ObjectSetFiboDescription(fiboobjname2,4,"61.8 %$");
ObjectSet(fiboobjname2, OBJPROP_FIRSTLEVEL+5, 0.786);
ObjectSetFiboDescription(fiboobjname2,5,"78.6 %$");
ObjectSet(fiboobjname2, OBJPROP_FIRSTLEVEL+6, 1.000);
ObjectSetFiboDescription(fiboobjname2,6,"100.0 %$");
ObjectSet(fiboobjname2, OBJPROP_FIRSTLEVEL+7, -0.272);
ObjectSetFiboDescription(fiboobjname2,7,"127.2 %$");
ObjectSet(fiboobjname2, OBJPROP_FIRSTLEVEL+8, -0.618);
ObjectSetFiboDescription(fiboobjname2,8,"161.8 %$");
if(lasti<=lastj) ObjectSet( "Fibu", OBJPROP_LEVELCOLOR, Crimson) ;
else ObjectSet( "Fibu", OBJPROP_LEVELCOLOR, DarkGreen) ;
ObjectsRedraw();
}
}
return(0);
}
double ChoppinessIndex(int period, int bar)
{
double Low0 = 0, High0 = 0, Close1 = 0;
double TrueRangeLow = 0, TrueRangeHigh = 0, TrueRangeSum = 0, Input = 0;
double PeriodTrueRangeLow = 999999999, PeriodTrueRangeHigh = 0, PeriodTrueRange = 0;
for(int k=bar; k<bar+period; k++)
{
Low0 = iLow(NULL,15,k);
High0 = iHigh(NULL,15,k);
Close1 = iClose(NULL,15,k+1);
if (Low0<Close1) TrueRangeLow = Low0; else TrueRangeLow = Close1;
if (High0>Close1) TrueRangeHigh = High0; else TrueRangeHigh = Close1;
if (TrueRangeLow <PeriodTrueRangeLow) PeriodTrueRangeLow = TrueRangeLow; // find true low of period
if (TrueRangeHigh>PeriodTrueRangeHigh) PeriodTrueRangeHigh = TrueRangeHigh; // find true high of period
TrueRangeSum += TrueRangeHigh;
TrueRangeSum -= TrueRangeLow;
}
PeriodTrueRange = PeriodTrueRangeHigh - PeriodTrueRangeLow;
if (PeriodTrueRange==0) PeriodTrueRange = MathPow(10, -12); // avoid possibility of division by zero
Input = TrueRangeSum / PeriodTrueRange;
return ((logN(Input, 10, MathPow(10, -12)) / logN(period, 10, MathPow(10, -12))) * 100);
}
double logN(double x, double base, double epsilon)
{
double integer = 0.0;
if ((x < 1) || (base < 1)) return(0);
while (x < 1)
{
integer -= 1;
x *= base;
}
while (x >= base)
{
integer += 1;
x /= base;
}
double partial = 0.5;
x *= x;
double decimal = 0.0;
while (partial > epsilon)
{
if (x >= base)
{
decimal += partial;
x = x / base;
}
partial *= 0.5;
x *= x;
}
return (integer + decimal);
}
double StdDev(int shift, int samples)
{
double x0=0, x1=0, x2=0;
for (int m=0; m<samples; m++)
{
x0 = ExtMapBuffer[m+shift];
x1 += x0;
x2 += MathPow(x0,2);
}
return(MathSqrt((x2-(x1*x1/samples))/(samples-1))); // minimum samples is 2, enforced in the init section
}
//+------------------------------------------------------------------+
void deletetxt1(string what){
for(int iObj=ObjectsTotal()-1; iObj >= 0; iObj--){
string on = ObjectName(iObj);
if(StringFind(on, what) == 0) ObjectDelete(on);
} }
The Head Buy Boxes

Short & longer term momentum added (14 & 67 samples)

