I have a Afl showing the VWAP in blocks,
I tried to show this in "Explore" showing columns for M1 in the red
/green/yellow as shown on screen.
The last line need modification.
Can any body help on this ?
Many thanks in advance.
Regards,
========================
_SECTION_BEGIN("Unnamed 2");
//1m
ec=WriteIf(EMA(C,5)>EMA(C,13) OR EMA(C,5)<EMA(C,13),"One","x");
ec2=WriteIf(EMA(C,5)>EMA(C,13) AND EMA(C,5)>EMA(C,20),"On","x");
ec3=WriteIf(EMA(C,5)<EMA(C,13) AND EMA(C,5)<EMA(C,20),"Oe","x");
//5m
TimeFrameSet(in5Minute);
e5=EMA(C,5);
e13=EMA(C,13);
e20=EMA(C,20);
TimeFrameRestore();
e5x5=TimeFrameExpand( e5, in5Minute,expandLast );
e5x13=TimeFrameExpand( e13, in5Minute,expandLast );
e5x20=TimeFrameExpand( e20, in5Minute,expandLast );
e5c=WriteIf(e5x5>e5x13 OR e5x5<e5x13,"One","x");
e5c2=WriteIf(e5x5>e5x13 AND e5x5>e5x20,"On","x");
e5c3=WriteIf(e5x5<e5x13 AND e5x5<e5x20,"Oe","x");
//15m
TimeFrameSet(in15Minute);
e15=EMA(C,5);
e113=EMA(C,13);
e120=EMA(C,20);
TimeFrameRestore();
e15x5=TimeFrameExpand( e15, in15Minute,expandLast );
e15x13=TimeFrameExpand( e113, in15Minute,expandLast );
e15x20=TimeFrameExpand( e120, in15Minute,expandLast );
e15c=WriteIf(e15x5>e15x13 OR e15x5<e15x13,"One","x");
e15c2=WriteIf(e15x5>e15x13 AND e15x5>e15x20,"On","x");
e15c3=WriteIf(e15x5<e15x13 AND e15x5<e15x20,"Oe","x");
//1h
TimeFrameSet(inHourly);
e51=EMA(C,5);
e131=EMA(C,13);
e201=EMA(C,20);
TimeFrameRestore();
ehx5=TimeFrameExpand( e51, inHourly,expandLast );
ehx13=TimeFrameExpand( e131, inHourly,expandLast );
ehx20=TimeFrameExpand( e201, inHourly,expandLast );
ehc=WriteIf(ehx5>ehx13 OR ehx5<ehx13,"One","x");
ehc2=WriteIf(ehx5>ehx13 AND ehx5>ehx20,"On","x");
ehc3=WriteIf(ehx5<ehx13 AND ehx5<ehx20,"Oe","x");
//4h
TimeFrameSet(inHourly*4);
eh51=EMA(C,5);
eh131=EMA(C,13);
eh201=EMA(C,20);
TimeFrameRestore();
eh4x5=TimeFrameExpand( eh51, inHourly4,expandLast );
eh4x13=TimeFrameExpand( eh131, inHourly4,expandLast );
eh4x20=TimeFrameExpand( eh201, inHourly*4,expandLast );
e4hc=WriteIf(eh4x5>eh4x13 OR eh4x5<eh4x13,"One","x");
e4hc2=WriteIf(eh4x5>eh4x13 AND eh4x5>eh4x20,"On","x");
e4hc3=WriteIf(eh4x5<eh4x13 AND eh4x5<eh4x20,"Oe","x");
//d
TimeFrameSet(inDaily);
ed5=EMA(C,5);
ed13=EMA(C,13);
ed20=EMA(C,20);
TimeFrameRestore();
edx5=TimeFrameExpand( ed5, inDaily,expandLast );
edx13=TimeFrameExpand( ed13, inDaily,expandLast );
edx20=TimeFrameExpand( ed20, inDaily,expandLast );
edc=WriteIf(edx5>edx13 OR edx5<edx13,"One","x");
edc2=WriteIf(edx5>edx13 AND edx5>edx20,"On","x");
edc3=WriteIf(edx5<edx13 AND edx5<edx20,"Oe","x");
TimeFrameSet(inWeekly);
ew5=EMA(C,5);
ew13=EMA(C,13);
ew20=EMA(C,20);
TimeFrameRestore();
ewx5=TimeFrameExpand( ew5, inWeekly,expandLast );
ewx13=TimeFrameExpand( ew13, inWeekly,expandLast );
ewx20=TimeFrameExpand( ew20, inWeekly,expandLast );
ewc=WriteIf(ewx5>ewx13 OR ewx5<ewx13,"One","x");
ewc2=WriteIf(ewx5>ewx13 AND ewx5>ewx20,"On","x");
ewc3=WriteIf(ewx5<ewx13 AND ewx5<ewx20,"Oe","x");
// Box
Hor=Param("Horizontal Position",1,1,1200,1);
Ver=Param("Vertical Position",60,30,1000,1);
///1 one minutues
GfxSelectFont("Callibri", 10 , 700, True );
GfxSetBkMode( colorBlack );
GfxSetTextColor( colorWhite );
//GfxTextOut("EMA Signal ",Hor, Ver);
GfxSetTextColor( colorWhite );
GfxTextOut("1 M ",Hor+72, Ver-15);
if(ec=="One")
GfxSelectSolidBrush(colorGold);
if(ec2=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(ec3=="Oe")
GfxSelectSolidBrush(colorRed);
GfxSelectPen( colorBlack, 1 ); // broader color
GfxRectangle( Hor+70,Ver+5,Hor+100,Ver+15 );
///2
GfxSetTextColor( colorWhite );
GfxTextOut("5 M ",Hor+112, Ver-15);
if(e5c=="One")
GfxSelectSolidBrush(colorGold);
if(e5c2=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(e5c3=="Oe")
GfxSelectSolidBrush(colorRed);
GfxRectangle( Hor+110,Ver+5,Hor+140,Ver+15 );
///3
GfxSetTextColor( colorWhite );
GfxTextOut("15 M ",Hor+150, Ver-15);
if(e15c=="One")
GfxSelectSolidBrush(colorGold);
if(e15c2=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(e15c3=="Oe")
GfxSelectSolidBrush(colorRed);
GfxRectangle( Hor+150,Ver+5,Hor+180,Ver+15 );
///4
GfxSetTextColor( colorWhite );
GfxTextOut("1 H ",Hor+193, Ver-15);
if(ehc=="One")
GfxSelectSolidBrush(colorGold);
if(ehc2=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(ehc3=="Oe")
GfxSelectSolidBrush(colorRed);
GfxRectangle( Hor+190,Ver+5,Hor+220,Ver+15 );
//4
if(e4hc=="One")
GfxSelectSolidBrush(colorGold);
if(e4hc2=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(e4hc3=="Oe")
GfxSelectSolidBrush(colorRed);
GfxRectangle( Hor+230,Ver+5,Hor+260,Ver+15 );
GfxSetTextColor( colorWhite );
GfxTextOut("4 H ",Hor+233, Ver-15);
if(edc=="One")
GfxSelectSolidBrush(colorGold);
if(edc2=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(edc3=="Oe")
GfxSelectSolidBrush(colorRed);
GfxRectangle( Hor+270,Ver+5,Hor+300,Ver+15 );
GfxTextOut("D ",Hor+280, Ver-15);
if(ewc=="One")
GfxSelectSolidBrush(colorGold);
if(ewc2=="On")
GfxSelectSolidBrush(colorBrightGreen);
if(ewc3=="Oe")
GfxSelectSolidBrush(colorRed);
GfxRectangle( Hor+310,Ver+5,Hor+340,Ver+15 );
GfxTextOut("Weekly ",Hor+310, Ver-15);
_SECTION_END();
//-------------------------------------------------------------------
Filter = c ;
AddColumn(C,"Close");
AddColumn(RSI(14),"RSI-14",1.2, IIf(RSI(14) > Ref(RSI(14),-1), colorGreen, colorRed),-1);
//AddColumn( iff(ec=="one","on","Oe"), "1M", formatChar, 1, bkcolor =IIf (ec=="on",colorRed, colorGold ));