Dear seniors
I need color changing of the line in this afl
When uptrend color green
when downtrend color red
AFL is below
_SECTION_BEGIN("ZIG-ZAG");
Z=Param("zig",1,0,10,0.1);
Plot( z1 = Zig(C,z), "Zig-zag Indicator" + _PARAM_VALUES(), ParamColor("Zig-zag color", colorOrange ), ParamStyle("Zig-zag style") );
Buy = Cover = Zig(C,z)>Ref(Zig(C,z),-1) AND Ref(Zig(C,z),-2)>Ref(Zig(C,z),-1);
Sell = Short = Zig(C,z)<Ref(Zig(C,z),-1) AND Ref(Zig(C,z),-2)<Ref(Zig(C,z),-1);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
AlertIf( Buy, "SOUND E:\\Windows\\Media\\notify.wav", "Audio alert", 2 );
AlertIf( Sell, "SOUND E:\\Windows\\Media\\chord.wav", "Audio alert", 2 );
Filter = Buy OR Sell;
PlotShapes(IIf(Buy, shapeCircle, shapeNone),colorGreen, 0,BuyPrice, 0);
PlotShapes(IIf(Sell, shapeCircle, shapeNone),colorRed, 0,SellPrice, 0);
dist = 1.5*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy ) PlotText( "BUY\n"+C[ i ], i, BuyPrice-dist,colorWhite, colorGreen );
if( Sell ) PlotText( "SELL\n"+C[ i ], i, SellPrice+dist,colorWhite, colorRed );
//if( Short ) PlotText( "Short\n@" + C[ i ], i, H[ i ]+dist, colorRed, colorYellow );
//if( Cover ) PlotText( "Cover\n@" + C[ i ], i, L[ i ]-dist,colorGreen );
}
Thanks in advance
I need color changing of the line in this afl
When uptrend color green
when downtrend color red
AFL is below
_SECTION_BEGIN("ZIG-ZAG");
Z=Param("zig",1,0,10,0.1);
Plot( z1 = Zig(C,z), "Zig-zag Indicator" + _PARAM_VALUES(), ParamColor("Zig-zag color", colorOrange ), ParamStyle("Zig-zag style") );
Buy = Cover = Zig(C,z)>Ref(Zig(C,z),-1) AND Ref(Zig(C,z),-2)>Ref(Zig(C,z),-1);
Sell = Short = Zig(C,z)<Ref(Zig(C,z),-1) AND Ref(Zig(C,z),-2)<Ref(Zig(C,z),-1);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
AlertIf( Buy, "SOUND E:\\Windows\\Media\\notify.wav", "Audio alert", 2 );
AlertIf( Sell, "SOUND E:\\Windows\\Media\\chord.wav", "Audio alert", 2 );
Filter = Buy OR Sell;
PlotShapes(IIf(Buy, shapeCircle, shapeNone),colorGreen, 0,BuyPrice, 0);
PlotShapes(IIf(Sell, shapeCircle, shapeNone),colorRed, 0,SellPrice, 0);
dist = 1.5*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy ) PlotText( "BUY\n"+C[ i ], i, BuyPrice-dist,colorWhite, colorGreen );
if( Sell ) PlotText( "SELL\n"+C[ i ], i, SellPrice+dist,colorWhite, colorRed );
//if( Short ) PlotText( "Short\n@" + C[ i ], i, H[ i ]+dist, colorRed, colorYellow );
//if( Cover ) PlotText( "Cover\n@" + C[ i ], i, L[ i ]-dist,colorGreen );
}
Thanks in advance