help dear

#1
i have that code :
_SECTION_BEGIN("New formula");
PeriodEMA = 13;
MACDIndicatorRange = 50;

// Volume filter
VolumeFilter = Param( "Volume MA filter", 100000, 50000, 500000, 100000 );
Timeframe = Interval(2);

// Adjust for weekly if necessary
if( Timeframe == "5-day" || Timeframe == "Weekly" ) {
VolumeFilter = VolumeFilter * 5;
}
else if( Timeframe == "Monthly") {
VolumeFilter = VolumeFilter * 20;
}
else if( Timeframe != "Daily" ) {
VolumeFilter = 0;
}
_SECTION_END();

MACDDivMinWidth = Param("Divergence min width", 4, 1, 10, 1 );


HistMinWidth = Param("Histogram min width", 4, 1, 10, 1 );


PeriodEMA = Optimize( "PeriodEMA ", 13, 5, 23, 1 );


OpenPositions = 10;
ATRPeriod = 5;
InitialCapital = 100000;

PeriodFast = Param( "Fast EMA", 12, 2, 200, 1 );
PeriodSlow = Param( "Slow EMA", 26, 2, 200, 1 );
PeriodSignal = Param( "Signal EMA", 9, 2, 200, 1 );
MACDInd = MACD(PeriodFast, PeriodSlow );
SigInd = Signal(PeriodFast, PeriodSlow , PeriodSignal );
HistInd = MACDInd - SigInd ;
_N( macdStr = WriteVal( PeriodFast, 1.0 )+","+WriteVal( PeriodSlow , 1.0 ) );
_N( sigStr = macdStr + ","+WriteVal( PeriodSignal , 1.0 ) );

scMACDMax = LastValue(HHV(Max(MACDInd, sigInd),
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scMACDMin = LastValue(LLV(Min(MACDInd, sigInd),
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scaleMACD = Max( abs(scMACDMax), abs(scMACDMin) );

scHistMax = LastValue(HHV(HistInd,
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scHistMin = LastValue(LLV(HistInd,
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scaleHist = Max( abs(scHistMax), abs(scHistMin) );


_SECTION_BEGIN("Patterns Wave");
Change = Param("Wave Period",7,0,100,1);
SupResA = Param("Sup-Res A Period",20,0,100,1);
SupResB = Param("Sup-Res B Period",25,0,100,1);

Res1 = ParamColor("Resistance High", colorRed );
Res2 = ParamColor("Resistance Low", colorDarkRed );
Sup1 = ParamColor("Support High", colorDarkGreen );
Sup2 = ParamColor("Support Low", colorBrightGreen );


procedure PlotShapeAt( x, y, shape, shift )
{
PlotShapes( IIf( BarIndex() == x, shape, 0 ), colorRed, 0, y, shift );
}

bi = BarIndex();
sbi = SelectedValue( bi );
GraphXSpace = 2;
//Plot( Zig( C, Change ), "zig", colorWhite, styleThick );


_SECTION_BEGIN("New formula 3 1");
lookback = 8;

Use2Bars = "Yes";
LowVol = "Yes";
ClimaxUp = "Yes";
ClimaxDown = "Yes";
Churn = "Yes";
ClimaxChurn = "Yes";

LowVolColor = 8;
ClimaxUpColor = 9;
ClimaxDownColor = 1;
ChurnColor = 5;
ClimaxChurnColor = 0;
DefaultBarColor = 7;
AvgColor = 0;

Range = High-Low;
Value1 = IIf (Close >= Open,Volume * ((Range) / ((2+(Range*Range)/10) * Range + (Open - Close))),
Volume * (((Range + Close - Open)) / (2+(Range*Range)/10) * Range + (Close - Open)));
Value2 = Volume - Value1;

Value3 = Value1 + Value2;
Value4 = Value1 * Range;
Value5 = (Value1 - Value2) * Range;
Value6 = Value2 * Range;
Value7 = (Value2 - Value1) * Range;
Value8 = IIf (Range != 0, Value1 / Range, 1);
Value9 = IIf (Range != 0, (Value1 - Value2) / Range, 1);
Value10 = IIf (Range != 0, Value2 / Range, 1);
Value11 = IIf (Range != 0, (Value2 - Value1) / Range, 1);
Value12 = IIf (Range != 0, Value3 / Range, 1);
Value13 = IIf (Use2Bars=="Yes", Value3 + Ref(Value3,-1),1);
Value14 = IIf (Use2Bars=="Yes", (Value1 + Ref(Value1,-1))*(HHV(High,2)-LLV(Low,2)),1);
Value15 = IIf (Use2Bars=="Yes", (Value1 + Ref(Value1,-1)-Value2-Ref(Value2,-1))*(HHV(High,2)-LLV(Low,2)),1);
Value16 = IIf (Use2Bars=="Yes", (Value2 + Ref(Value2,-1))*(HHV(High,2)-LLV(Low,2)),1);
Value17 = IIf (Use2Bars=="Yes", (Value2 + Ref(Value2,-1)-Value1-Value1[1])*(HHV(High,2)-LLV(Low,2)),1);
Value18 = IIf ((Use2Bars=="Yes" AND (HHV(High,2)!=LLV(Low,2))),(Value1+Ref(Value1,-1))/(HHV(High,2)-LLV(Low,2)),1);
Value19 = IIf ((Use2Bars=="Yes" AND (HHV(High,2)!=LLV(Low,2))),(Value1+Ref(Value1,-1)-Value2-Ref(Value2,-1))/(HHV(High,2)-LLV(Low,2)),1);
Value20 = IIf ((Use2Bars=="Yes" AND (HHV(High,2)!=LLV(Low,2))),(Value2+Ref(Value2,-1))/(HHV(High,2)-LLV(Low,2)),1);
Value21 = IIf ((Use2Bars=="Yes" AND (HHV(High,2)!=LLV(Low,2))),(Value2+Ref(Value2,-1)-Value1-Ref(Value1,-1))/(HHV(High,2)-LLV(Low,2)),1);
Value22 = IIf ((Use2Bars=="Yes" AND (HHV(High,2)!=LLV(Low,2))),Value13/(HHV(High,2)-LLV(Low,2)),1);


Condition1 = IIf(Value3 == LLV(Value3, Lookback), 1, 0);
Condition2 = IIf((Value4 == HHV(Value4, Lookback) AND Close > Open), 1, 0);
Condition3 = IIf((Value5 == HHV(Value5, Lookback) AND Close > Open), 1, 0);
Condition4 = IIf((Value6 == HHV(Value6, Lookback) AND Close < Open), 1, 0);
Condition5 = IIf((Value7 == HHV(Value7, Lookback) AND Close < Open), 1, 0);
Condition6 = IIf((Value8 == LLV(Value8, Lookback) AND Close < Open), 1, 0);
Condition7 = IIf((Value9 == LLV(Value9, Lookback) AND Close < Open), 1, 0);
Condition8 = IIf((Value10 == LLV(Value10, Lookback) AND Close > Open), 1, 0);
Condition9 = IIf((Value11 == LLV(Value11, Lookback) AND Close > Open), 1, 0);
Condition10 = IIf(Value12 == HHV(Value12, lookback), 1, 0);
Condition11 = IIf (Use2Bars=="Yes" AND (Value13==LLV(Value13,Lookback) AND Close > Open AND Ref(Close,-1) > Ref(Open,-1)),1,0);
Condition12 = IIf (Use2Bars=="Yes" AND (Value14==HHV(Value14,Lookback) AND Close > Open AND Ref(Close,-1) > Ref(Open,-1)),1,0);
Condition13 = IIf (Use2Bars=="Yes" AND (Value15==HHV(Value15,Lookback) AND Close > Open AND Ref(Close,-1) < Ref(Open,-1)),1,0);
Condition14 = IIf (Use2Bars=="Yes" AND (Value16==LLV(Value16,Lookback) AND Close < Open AND Ref(Close,-1) < Ref(Open,-1)),1,0);
Condition15 = IIf (Use2Bars=="Yes" AND (Value17==LLV(Value17,Lookback) AND Close < Open AND Ref(Close,-1) < Ref(Open,-1)),1,0);
Condition16 = IIf (Use2Bars=="Yes" AND (Value18==LLV(Value18,Lookback) AND Close < Open AND Ref(Close,-1) < Ref(Open,-1)),1,0);
Condition17 = IIf (Use2Bars=="Yes" AND (Value19==LLV(Value19,Lookback) AND Close > Open AND Ref(Close,-1) < Ref(Open,-1)),1,0);
Condition18 = IIf (Use2Bars=="Yes" AND (Value20==LLV(Value20,Lookback) AND Close > Open AND Ref(Close,-1) > Ref(Open,-1)),1,0);
Condition19 = IIf (Use2Bars=="Yes" AND (Value21==LLV(Value21,Lookback) AND Close > Open AND Ref(Close,-1) > Ref(Open,-1)),1,0);
Condition20 = IIf (Use2Bars=="Yes" AND (Value22==LLV(Value22,Lookback)), 1,0);

Color=

IIf (ClimaxChurn== "Yes" AND (Condition10 OR Condition20) AND (Condition2 OR Condition3 OR Condition4 OR Condition5 OR Condition6 OR Condition7 OR Condition8 OR Condition9), colorViolet,
IIf (LowVol== "Yes" AND (Condition1 OR Condition11) , colorYellow,
IIf (ClimaxUp== "Yes" AND (Condition2 OR Condition3 OR Condition8 OR Condition9 OR Condition12 OR Condition13 OR Condition18 OR Condition19) , colorBlue,
IIf (ClimaxDown== "Yes" AND (Condition4 OR condition5 OR Condition6 OR Condition7 OR Condition14 OR Condition15 OR Condition16 OR Condition17) ,colorWhite,
IIf (Churn== "Yes" AND Condition10 OR Condition20,colorRed,colorGrey50 )))));

Plot(Volume, "Vol",Color,styleHistogram );
_SECTION_END();



how to search stock : today red bar and yesterday white bar... plz help me
 

Similar threads