hi, no I am not working on buy/sell rules. At least not at this point. In my previous message I meant something different. I have not included this yet. It is rather difficult because I can not do this in the compressed mode.
So for now I add the "No divergence couple". So "Regular divergence" preceded by "No divergence" is either the couple colorGold-colorBlue (bearish). Or colorPink-colorRed (bullish)
SetChartOptions( 0, chartShowArrows | chartShowDates );
periods = Param( "Periods", 20, 1, 200, 1 );
n = Param( "% Reverse ", 20, 0, 100, 1 );
displayMode1 = ParamToggle( "Display Price or RSI", "Price|RSI", 1 );
displayMode2 = ParamToggle( "Display All Divergences or Just the Couples", "Show All|Show Couple Only", 1 );
ZigZag = line1 = line2 = Null;
func1 = C;
func2 = RSIa( C, periods );
bi = BarIndex();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );
Var = Zig( func2, n );
tr = Trough( func2, n, 1 );
pk = Peak( func2, n, 1 );
tr1 = Trough( func2, n, 1 ) == Var;
pk1 = Peak( func2, n, 1 ) == Var;
// zigzag func1
prch = H;
prcl = L;
zigup = Flip( tr1, pk1 );
zigupLow = ValueWhen( tr1, prcl, 1 );
zigupHigh = ValueWhen( pk1, prch, 0 );
zigupLowIndex = ValueWhen( tr1, bi, 1 );
zigupHighIndex = ValueWhen( pk1, bi, 0 );
slopeup = IIf( zigup, ( zigupHigh - zigupLow ) / ( zigupHighIndex - zigupLowIndex ) , Null );
zigupLine = IIf( zigup, zigupLow + slopeup * BarsSince( tr1 ), Null );
zigdn = Flip( pk1, tr1 );
zigdnLow = ValueWhen( tr1, prcl, 0 );
zigdnHigh = ValueWhen( pk1, prch, 1 );
zigdnLowIndex = ValueWhen( tr1, bi, 0 );
zigdnHighIndex = ValueWhen( pk1, bi, 1 );
slopedn = IIf( zigdn, ( zigdnLow - zigdnHigh ) / ( zigdnLowIndex - zigdnHighIndex ) , Null );
zigdnLine = IIf( zigdn, zigdnHigh + slopedn * BarsSince( pk1 ), Null );
ZigZag = IIf( zigup, zigupLine, IIf( zigdn, zigdnLine, Null ) );
ZigZag = IIf( bi > Max( LastValue( ValueWhen( tr1, bi ) ), LastValue( ValueWhen( pk1, bi ) ) ), Null, ZigZag );
ZigZag = IIf( !IsEmpty( line1 ), line1, ZigZag );
for( i = 0; i < 3; i++ )
{
VarSet( "px" + i, ValueWhen( pk1, bi, i ) );
VarSet( "tx" + i, ValueWhen( tr1, bi, i ) );
VarSet( "ph" + i, ValueWhen( pk1, H, i ) );
VarSet( "tl" + i, ValueWhen( tr1, L, i ) );
}
// No divergence
onlywhen = pk == Var;
pkPrice = SparseCompress( onlywhen, func1 );
pkRsi = SparseCompress( onlywhen, pk );
pkBiN = SparseCompress( onlywhen, bi );
SellN = pkPrice < Ref( pkPrice, -1 ) AND pkRsi < Ref( pkRsi, -1 );
SellNo = SparseExpand( onlywhen, SellN );
slopeSN1 = SafeDivide( pkPrice - Ref( pkPrice, -1 ), pkBiN - Ref( pkBiN, -1 ) );
slopeSN2 = SafeDivide( pkRsi - Ref( pkRsi, -1 ), pkBiN - Ref( pkBiN, -1 ) );
slopeSN1 = SparseExpand( onlywhen, slopeSN1 );
slopeSN2 = SparseExpand( onlywhen, slopeSN2 );
f2Sy0N = SparseExpand( onlywhen, Ref( pkRsi, -1 ) );
f2Sy1N = SparseExpand( onlywhen, pkRsi );
f2Sx0N = SparseExpand( onlywhen, Ref( pkBiN, -1 ) );
f1Sy0N = SparseExpand( onlywhen, Ref( pkPrice, -1 ) );
f1Sy1N = SparseExpand( onlywhen, pkPrice );
f1Sx0N = SparseExpand( onlywhen, Ref( pkBiN, -1 ) );
onlywhen = tr == Var;
thPrice = SparseCompress( onlywhen, func1 );
thRsi = SparseCompress( onlywhen, tr );
thBiN = SparseCompress( onlywhen, bi );
BuyN = thPrice > Ref( thPrice, -1 ) AND thRsi > Ref( thRsi, -1 );
BuyNo = SparseExpand( onlywhen, BuyN );
slopeBN1 = SafeDivide( thPrice - Ref( thPrice, -1 ), thBiN - Ref( thBiN, -1 ) );
slopeBN2 = SafeDivide( thRsi - Ref( thRsi, -1 ), thBiN - Ref( thBiN, -1 ) );
slopeBN1 = SparseExpand( onlywhen, slopeBN1 );
slopeBN2 = SparseExpand( onlywhen, slopeBN2 );
f2By0N = SparseExpand( onlywhen, Ref( thRsi, -1 ) );
f2By1N = SparseExpand( onlywhen, thRsi );
f2Bx0N = SparseExpand( onlywhen, Ref( thBiN, -1 ) );
f1By0N = SparseExpand( onlywhen, Ref( thPrice, -1 ) );
f1By1N = SparseExpand( onlywhen, thPrice );
f1Bx0N = SparseExpand( onlywhen, Ref( thBiN, -1 ) );
// Hidden divergence
onlywhen = pk == Var;
pkPrice = SparseCompress( onlywhen, func1 );
pkRsi = SparseCompress( onlywhen, pk );
pkBiH = SparseCompress( onlywhen, bi );
SellH = pkPrice < Ref( pkPrice, -1 ) AND pkRsi > Ref( pkRsi, -1 );
SellHo = SparseExpand( onlywhen, SellH );
slopeSH1 = SafeDivide( pkPrice - Ref( pkPrice, -1 ), pkBiH - Ref( pkBiH, -1 ) );
slopeSH2 = SafeDivide( pkRsi - Ref( pkRsi, -1 ), pkBiH - Ref( pkBiH, -1 ) );
slopeSH1 = SparseExpand( onlywhen, slopeSH1 );
slopeSH2 = SparseExpand( onlywhen, slopeSH2 );
f2Sy0H = SparseExpand( onlywhen, Ref( pkRsi, -1 ) );
f2Sy1H = SparseExpand( onlywhen, pkRsi );
f2Sx0H = SparseExpand( onlywhen, Ref( pkBiH, -1 ) );
f1Sy0H = SparseExpand( onlywhen, Ref( pkPrice, -1 ) );
f1Sy1H = SparseExpand( onlywhen, pkPrice );
f1Sx0H = SparseExpand( onlywhen, Ref( pkBiH, -1 ) );
onlywhen = tr == Var;
thPrice = SparseCompress( onlywhen, func1 );
thRsi = SparseCompress( onlywhen, tr );
thBiH = SparseCompress( onlywhen, bi );
BuyH = thPrice > Ref( thPrice, -1 ) AND thRsi < Ref( thRsi, -1 );
BuyHo = SparseExpand( onlywhen, BuyH );
slopeBH1 = SafeDivide( thPrice - Ref( thPrice, -1 ), thBiH - Ref( thBiH, -1 ) );
slopeBH2 = SafeDivide( thRsi - Ref( thRsi, -1 ), thBiH - Ref( thBiH, -1 ) );
slopeBH1 = SparseExpand( onlywhen, slopeBH1 );
slopeBH2 = SparseExpand( onlywhen, slopeBH2 );
f2By0H = SparseExpand( onlywhen, Ref( thRsi, -1 ) );
f2By1H = SparseExpand( onlywhen, thRsi );
f2Bx0H = SparseExpand( onlywhen, Ref( thBiH, -1 ) );
f1By0H = SparseExpand( onlywhen, Ref( thPrice, -1 ) );
f1By1H = SparseExpand( onlywhen, thPrice );
f1Bx0H = SparseExpand( onlywhen, Ref( thBiH, -1 ) );
// Regular divergence
onlywhen = pk == Var;
pkPrice = SparseCompress( onlywhen, func1 );
pkRsi = SparseCompress( onlywhen, pk );
pkBiR = SparseCompress( onlywhen, bi );
SellR = pkPrice > Ref( pkPrice, -1 ) AND pkRsi < Ref( pkRsi, -1 );
SellRo = SparseExpand( onlywhen, SellR );
SellRH = SparseExpand( onlywhen, SellR ) AND ValueWhen( BuyHo, bi ) > px2;
SellRN = SparseExpand( onlywhen, SellR ) AND ValueWhen( BuyNo, bi ) > px2;
SellR = SellRH OR SellRN;
slopeSR1 = SafeDivide( pkPrice - Ref( pkPrice, -1 ), pkBiR - Ref( pkBiR, -1 ) );
slopeSR2 = SafeDivide( pkRsi - Ref( pkRsi, -1 ), pkBiR - Ref( pkBiR, -1 ) );
slopeSR1 = SparseExpand( onlywhen, slopeSR1 );
slopeSR2 = SparseExpand( onlywhen, slopeSR2 );
slopeSR1 = ValueWhen( SellR, slopeSR1 );
slopeSR2 = ValueWhen( SellR, slopeSR2 );
f2Sy0R = SparseExpand( onlywhen, Ref( pkRsi, -1 ) );
f2Sy1R = SparseExpand( onlywhen, pkRsi );
f2Sx0R = SparseExpand( onlywhen, Ref( pkBiR, -1 ) );
f1Sy0R = SparseExpand( onlywhen, Ref( pkPrice, -1 ) );
f1Sy1R = SparseExpand( onlywhen, pkPrice );
f1Sx0R = SparseExpand( onlywhen, Ref( pkBiR, -1 ) );
// blue extension
SRExt1 = IIf( Flip( SellRo, ( SellN OR SellH ) ), ValueWhen( SellR, f1Sy1R ) + slopeSR1 * BarsSince( SellR ), Null );
SRExt2 = IIf( Flip( SellRo, ( SellN OR SellH ) ), ValueWhen( SellR, var ) + slopeSR2 * BarsSince( SellR ), Null );
SRExt1 = IIf( SellR, Null, SRExt1 );
SRExt2 = IIf( SellR, Null, SRExt2 );
onlywhen = tr == Var;
thPrice = SparseCompress( onlywhen, func1 );
thRsi = SparseCompress( onlywhen, tr );
thBiR = SparseCompress( onlywhen, bi );
BuyR = thPrice < Ref( thPrice, -1 ) AND thRsi > Ref( thRsi, -1 );
BuyRo = SparseExpand( onlywhen, BuyR );
BuyRH = SparseExpand( onlywhen, BuyR ) AND ValueWhen( SellHo, bi ) > tx2;
BuyRN = SparseExpand( onlywhen, BuyR ) AND ValueWhen( SellNo, bi ) > tx2;
BuyR = BuyRH OR BuyRN;
slopeBR1 = SafeDivide( thPrice - Ref( thPrice, -1 ), thBiR - Ref( thBiR, -1 ) );
slopeBR2 = SafeDivide( thRsi - Ref( thRsi, -1 ), thBiR - Ref( thBiR, -1 ) );
slopeBR1 = SparseExpand( onlywhen, slopeBR1 );
slopeBR2 = SparseExpand( onlywhen, slopeBR2 );
slopeBR1 = ValueWhen( BuyR, slopeBR1 );
slopeBR2 = ValueWhen( BuyR, slopeBR2 );
f2By0R = SparseExpand( onlywhen, Ref( thRsi, -1 ) );
f2By1R = SparseExpand( onlywhen, thRsi );
f2Bx0R = SparseExpand( onlywhen, Ref( thBiR, -1 ) );
f2Bx1R = SparseExpand( onlywhen, thBiR );
f1By0R = SparseExpand( onlywhen, Ref( thPrice, -1 ) );
f1By1R = SparseExpand( onlywhen, thPrice );
f1Bx0R = SparseExpand( onlywhen, Ref( thBiR, -1 ) );
f1Bx1R = SparseExpand( onlywhen, thBiR );
// colorRed extension
BRExt1 = IIf( Flip( BuyRo, ( BuyH OR BuyN ) ), ValueWhen( BuyR, f1By1R ) + slopeBR1 * BarsSince( BuyR ), Null );
BRExt2 = IIf( Flip( BuyRo, ( BuyH OR BuyN ) ), ValueWhen( BuyR, var ) + slopeBR2 * BarsSince( BuyR ), Null );
BRExt1 = IIf( BuyR, Null, BRExt1 );
BRExt2 = IIf( BuyR, Null, BRExt2 );
// colorOrange extension
BuyHo1 = BuyHo AND ValueWhen( SellR, bi, 0 ) == px0;
slopeBH1 = ValueWhen( BuyHo1, slopeBH1 );
slopeBH2 = ValueWhen( BuyHo1, slopeBH2 );
BHExt1 = IIf( Flip( BuyHo1, ( BuyR OR BuyN ) ), ValueWhen( BuyHo1, f1By1H ) + slopeBH1 * BarsSince( BuyHo1 ), Null );
BHExt2 = IIf( Flip( BuyHo1, ( BuyR OR BuyN ) ), ValueWhen( BuyHo1, var ) + slopeBH2 * BarsSince( BuyHo1 ), Null );
BHExt1 = IIf( BuyHo1, Null, BHExt1 );
BHExt2 = IIf( BuyHo1, Null, BHExt2 );
// colorGold extension
BuyNo1 = BuyNo AND ValueWhen( SellR, bi, 0 ) == px0;
slopeBN1 = ValueWhen( BuyNo1, slopeBN1 );
slopeBN2 = ValueWhen( BuyNo1, slopeBN2 );
BNExt1 = IIf( Flip( BuyNo1, ( BuyR OR BuyH ) ), ValueWhen( BuyNo1, f1By1N ) + slopeBN1 * BarsSince( BuyNo1 ), Null );
BNExt2 = IIf( Flip( BuyNo1, ( BuyR OR BuyH ) ), ValueWhen( BuyNo1, var ) + slopeBN2 * BarsSince( BuyNo1 ), Null );
BNExt1 = IIf( BuyNo1, Null, BNExt1 );
BNExt2 = IIf( BuyNo1, Null, BNExt2 );
// colorAqua extension
SellHo1 = SellHo AND ValueWhen( BuyR, bi, 0 ) == tx0;
slopeSH1 = ValueWhen( SellHo1, slopeSH1 );
slopeSH2 = ValueWhen( SellHo1, slopeSH2 );
SHExt1 = IIf( Flip( SellHo1, ( SellN OR SellR ) ), ValueWhen( SellHo1, f1Sy1H ) + slopeSH1 * BarsSince( SellHo1 ), Null );
SHExt2 = IIf( Flip( SellHo1, ( SellN OR SellR ) ), ValueWhen( SellHo1, var ) + slopeSH2 * BarsSince( SellHo1 ), Null );
SHExt1 = IIf( SellHo1, Null, SHExt1 );
SHExt2 = IIf( SellHo1, Null, SHExt2 );
// colorPink extension
SellNo1 = SellNo AND ValueWhen( BuyR, bi, 0 ) == tx0;
slopeSN1 = ValueWhen( SellNo1, slopeSN1 );
slopeSN2 = ValueWhen( SellNo1, slopeSN2 );
SNExt1 = IIf( Flip( SellNo1, ( SellH OR SellR ) ), ValueWhen( SellNo1, f1Sy1N ) + slopeSN1 * BarsSince( SellNo1 ), Null );
SNExt2 = IIf( Flip( SellNo1, ( SellH OR SellR ) ), ValueWhen( SellNo1, var ) + slopeSN2 * BarsSince( SellNo1 ), Null );
SNExt1 = IIf( SellNo1, Null, SNExt1 );
SNExt2 = IIf( SellNo1, Null, SNExt2 );
BuySig = BuyR;
buyLevel = ValueWhen( BuySig, func2 + func2 * ( n / 100 ) );
crx = Ref( Cross( func2, buyLevel ), -1 );
crx = IIf( BuySig, 0, crx );
buyLevel = IIf( Flip( BuySig, crx ), buyLevel, Null );
dotBuy = IIf( buyLevel AND Cross( func2, buyLevel ), 1, 0 );
SellSig = SellR;
sellLevel = ValueWhen( SellSig, func2 - func2 * ( n / 100 ) );
crx = Ref( Cross( sellLevel, func2 ), -1 );
crx = IIf( SellSig, 0, crx );
sellLevel = IIf( Flip( SellSig, crx ), sellLevel, Null );
dotSell = IIf( sellLevel AND Cross( sellLevel, func2 ), 1, 0 );
lineThickness1 = 5;
lineThickness2 = 1;
if( displayMode1 )
{
Overbought = 70;
Oversold = 30;
Centre = 50;
Plot( Overbought, "", colorRed );
Plot( Oversold, "", colorGreen );
Plot( Centre, "", colorWhite, styleDashed );
Plot( func2, "RSI mode", colorViolet, styleLine, Null, Null, 0, 0, 2 );
Plot( var, "", ColorRGB( 80, 80, 80 ), styleDashed | styleNoRescale, Null, Null, 0, -1, 1 );
PlotShapes( shapeSmallCircle * tr1, ColorRGB( 0, 0, 255 ), 0, var, -10 );
PlotShapes( shapeSmallCircle * pk1, ColorRGB( 255, 0, 0 ), 0, var, 10 );
if( !displaymode2 )
{
for( b = fvb; b <= lvb; b ++ )
{
if( BuyRo[b] )
{
Plot( LineArray( f2Bx0R[b], f2By0R[b], b, f2By1R[b] ), "", colorRed, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( BRExt2, "", colorRed, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( BuyHo[b] )
{
Plot( LineArray( f2Bx0H[b], f2By0H[b], b, f2By1H[b] ), "", colorOrange, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( BHExt2, "", colorOrange, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( BuyNo[b] )
{
Plot( LineArray( f2Bx0N[b], f2By0N[b], b, f2By1N[b] ), "", colorGold, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( BNExt2, "", colorGold, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( SellRo[b] )
{
Plot( LineArray( f2Sx0R[b], f2Sy0R[b], b, f2Sy1R[b] ), "", colorBlue, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( SRExt2, "", colorBlue, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( SellHo[b] )
{
Plot( LineArray( f2Sx0H[b], f2Sy0H[b], b, f2Sy1H[b] ), "", colorAqua, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( SHExt2, "", colorAqua, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( SellNo[b] )
{
Plot( LineArray( f2Sx0N[b], f2Sy0N[b], b, f2Sy1N[b] ), "", colorPink, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( SNExt2, "", colorPink, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
}
}
else
{
for( b = fvb; b <= lvb; b ++ )
{
if( BuyR[b] AND BuyRH[b] )
{
Plot( LineArray( f2Bx0R[b], f2By0R[b], b, f2By1R[b] ), "", colorRed, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( LineArray( f2Sx0H[px1[b]], f2Sy0H[px1[b]], px1[b], f2Sy1H[px1[b]] ), "", colorAqua, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( BRExt2, "", colorRed, styleDashed | styleNoRescale | styleNoLabel, Null, Null, 0, -1, lineThickness2 );
Plot( SHExt2, "", colorAqua, styleDashed | styleNoRescale | styleNoLabel, Null, Null, 0, -1, lineThickness2 );
}
else
if( BuyR[b] AND BuyRN[b] )
{
Plot( LineArray( f2Bx0R[b], f2By0R[b], b, f2By1R[b] ), "", colorRed, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( LineArray( f2Sx0N[px1[b]], f2Sy0N[px1[b]], px1[b], f2Sy1N[px1[b]] ), "", colorPink, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( BRExt2, "", colorRed, styleDashed | styleNoRescale | styleNoLabel, Null, Null, 0, -1, lineThickness2 );
Plot( SNExt2, "", colorPink, styleDashed | styleNoRescale | styleNoLabel, Null, Null, 0, -1, lineThickness2 );
}
else
if( SellR[b] AND SellRH[b] )
{
Plot( LineArray( f2Sx0R[b], f2Sy0R[b], b, f2Sy1R[b] ), "", colorBlue, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( LineArray( f2Bx0H[tx1[b]], f2By0H[tx1[b]], tx1[b], f2By1H[tx1[b]] ), "", colorOrange, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( SRExt2, "", colorBlue, styleDashed | styleNoRescale | styleNoLabel, Null, Null, 0, -1, lineThickness2 );
Plot( BHExt2, "", colorOrange, styleDashed | styleNoRescale | styleNoLabel, Null, Null, 0, -1, lineThickness2 );
}
else
if( SellR[b] AND SellRN[b] )
{
Plot( LineArray( f2Sx0R[b], f2Sy0R[b], b, f2Sy1R[b] ), "", colorBlue, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( LineArray( f2Bx0N[tx1[b]], f2By0N[tx1[b]], tx1[b], f2By1N[tx1[b]] ), "", colorGold, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( SRExt2, "", colorBlue, styleDashed | styleNoRescale | styleNoLabel, Null, Null, 0, -1, lineThickness2 );
Plot( BNExt2, "", colorGold, styleDashed | styleNoRescale | styleNoLabel, Null, Null, 0, -1, lineThickness2 );
}
}
}
Plot( buyLevel, "", colorYellow, styleDashed | styleNoRescale, Null, Null, 0, 0, 1 );
PlotShapes( IIf( dotBuy, shapeSmallSquare, shapeNone ), colorAqua, 0, func2, 0, 0 );
Plot( sellLevel, "", colorYellow, styleDashed | styleNoRescale, Null, Null, 0, 0, 1 );
PlotShapes( IIf( dotSell, shapeSmallSquare, shapeNone ), colorOrange, 0, func2, 0, 0 );
PlotShapes( IIf( dotSell, shapeDownArrow, shapeNone ), colorRed, 0 , func2, Offset = -20 );
PlotShapes( IIf( dotBuy, shapeUpArrow, shapeNone ), colorBrightGreen, 0, func2, Offset = -20 );
}
else
{
Plot( func1, "Price mode", colorViolet, styleCandle, Null, Null, 0, 0, 1 );
Plot( zigzag, "", ColorRGB( 80, 80, 80 ), styleDashed | styleNoRescale, Null, Null, 0, -1, 1 );
PlotShapes( shapeSmallCircle * tr1, ColorRGB( 0, 0, 255 ), 0, L, -10 );
PlotShapes( shapeSmallCircle * pk1, ColorRGB( 255, 0, 0 ), 0, H, 10 );
if( !displaymode2 )
{
for( b = fvb; b <= lvb; b ++ )
{
if( BuyRo[b] )
{
Plot( LineArray( f1Bx0R[b], f1By0R[b], b, f1By1R[b] ), "", colorRed, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( BRExt1, "", colorRed, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( BuyHo[b] )
{
Plot( LineArray( f1Bx0H[b], f1By0H[b], b, f1By1H[b] ), "", colorOrange, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( BHExt1, "", colorOrange, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( BuyNo[b] )
{
Plot( LineArray( f1Bx0N[b], f1By0N[b], b, f1By1N[b] ), "", colorGold, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( BNExt1, "", colorGold, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( SellRo[b] )
{
Plot( LineArray( f1Sx0R[b], f1Sy0R[b], b, f1Sy1R[b] ), "", colorBlue, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( SRExt1, "", colorBlue, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( SellHo[b] )
{
Plot( LineArray( f1Sx0H[b], f1Sy0H[b], b, f1Sy1H[b] ), "", colorAqua, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( SHExt1, "", colorAqua, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( SellNo[b] )
{
Plot( LineArray( f1Sx0N[b], f1Sy0N[b], b, f1Sy1N[b] ), "", colorPink, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( SNExt1, "", colorPink, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
}
}
else
{
for( b = fvb; b <= lvb; b ++ )
{
if( BuyR[b] AND BuyRH[b] )
{
Plot( LineArray( f1Bx0R[b], f1By0R[b], b, f1By1R[b] ), "", colorRed, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( LineArray( f1Sx0H[px1[b]], f1Sy0H[px1[b]], px1[b], f1Sy1H[px1[b]] ), "", colorAqua, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( BRExt1, "", colorRed, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
Plot( SHExt1, "", colorAqua, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( BuyR[b] AND BuyRN[b] )
{
Plot( LineArray( f1Bx0R[b], f1By0R[b], b, f1By1R[b] ), "", colorRed, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( LineArray( f1Sx0N[px1[b]], f1Sy0N[px1[b]], px1[b], f1Sy1N[px1[b]] ), "", colorPink, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( BRExt1, "", colorRed, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
Plot( SNExt1, "", colorPink, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( SellR[b] AND SellRH[b] )
{
Plot( LineArray( f1Sx0R[b], f1Sy0R[b], b, f1Sy1R[b] ), "", colorBlue, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( LineArray( f1Bx0H[tx1[b]], f1By0H[tx1[b]], tx1[b], f1By1H[tx1[b]] ), "", colorOrange, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( SRExt1, "", colorBlue, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
Plot( BHExt1, "", colorOrange, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
else
if( SellR[b] AND SellRN[b] )
{
Plot( LineArray( f1Sx0R[b], f1Sy0R[b], b, f1Sy1R[b] ), "", colorBlue, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( LineArray( f1Bx0N[tx1[b]], f1By0N[tx1[b]], tx1[b], f1By1N[tx1[b]] ), "", colorGold, styleLine, Null, Null, 0, 0, lineThickness1 );
Plot( SRExt1, "", colorBlue, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
Plot( BNExt1, "", colorGold, styleDashed | styleNoRescale, Null, Null, 0, -1, lineThickness2 );
}
}
}
PlotShapes( IIf( dotSell, shapeDownArrow, shapeNone ), colorRed, 0 , H, -20, 0 );
PlotShapes( IIf( dotBuy, shapeUpArrow, shapeNone ), colorBrightGreen, 0, L, -20, 0 );
PlotShapes( IIf( dotSell, shapeSmallCircle, shapeNone ), colorWhite, 0 , C, 0, 0 );
PlotShapes( IIf( dotBuy, shapeSmallCircle, shapeNone ), colorWhite, 0, C, 0, 0 );
}