Need Help for Exploration

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, inHourly
4,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 ));

When posting the formula, please make sure that you use Code Tags (using </> code button) as explained here: How to use this site.

Using code button

Code tags are required so formulas can be properly displayed and copied without errors.

you have been 4 years away from the forum.

welcome back.

see what Tomase asked you to do above when you insert code .

_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, inHourly *4,expandLast );
eh4x13=TimeFrameExpand( eh131, inHourly *4,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( IIf(StrToNum(ec ),StrToNum( ec2 ),StrToNum( ec2 ) ), "1M", formatChar, 1, bkcolor =IIf (StrToNum(ec ),colorRed, colorGold ));

i change it to

AddColumn( IIf(StrToNum(ec ),StrToNum( ec2 ),StrToNum( ec2 ) ), "1M", formatChar, 1, bkcolor =IIf (StrToNum(ec ),colorRed, colorGold ));

i am trying to help.

Many thanks for the help. :pray:
But on Explorer, I am still not able to get the colors.
In the code, I am getting trends on the screen in Green / red and yellow. I want to see it in the explorer tab of Amibroker.

I am trying it for 1 M first.
The screenshot as is below :

colors

How can we do it the Explorer, Need help.
Thanks in advance.

is this ok with you


_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, inHourly *4,expandLast );
eh4x13=TimeFrameExpand( eh131, inHourly *4,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();

//-------------------------------------------------------------------


ec_color = IIf(SelectedValue(EMA(C,5)) > SelectedValue(EMA(C,13)) OR SelectedValue( EMA(C,5)) < SelectedValue( EMA(C,13)),colorGold,
	 IIf(SelectedValue(EMA(C,5)) > SelectedValue(EMA(C,13)) AND SelectedValue( EMA(C,5)) > SelectedValue(EMA(C,20)),colorBrightGreen,
	 IIf(SelectedValue(EMA(C,5)) < SelectedValue(EMA(C,13) ) AND SelectedValue(EMA(C,5)) < SelectedValue(EMA(C,20)),colorRed,colorDefault))); 

Filter = c ;

AddColumn(C,"Close");

AddColumn(RSI(14),"RSI-14",1.2, IIf(RSI(14) > Ref(RSI(14),-1), colorGreen, colorRed),-1);

AddColumn( IIf(StrToNum(ec ),StrToNum( ec2 ),StrToNum( ec3 ) ), "1M", 1.2,ec_color, ec_color);

working without SelectedValue

ec_color = IIf(EMA(C,5)>EMA(C,13) OR EMA(C,5)<EMA(C,13),colorGold,
	 IIf(EMA(C,5)>EMA(C,13) AND EMA(C,5)>EMA(C,20),colorBrightGreen,
	 IIf(EMA(C,5)<EMA(C,13) AND EMA(C,5)<EMA(C,20),colorBlue,colorRed)));

Thanks for the reply, but we are still missing some codes... we are always getting gold color in the Exploration. Please again look into the codes :pray:
Regards

@Bsedoha, the function you need to use is AddMultiTextColumn().
It adds a text column to the exploration where text displayed is chosen based on array value. Search the forum for multiple examples.

To achieve what you have in mind, you need to rework your code: instead of assigning "strings" to your variables (using WriteIf()) you should create arrays using Iif() replacing your string with some numeric values (like 0 for "x", 1 for "One", 2 for "On", 3 for "Oe").
Then, for the chart, use the SelectedValue() over the resulting arrays to get the value corresponding to the selected bar (and use it to derive the "box" color).

By the way, your code is very repetitive (and, in general, in these case it is easy to introduce errors due to copy & paste operation).

I suggest using a simple loop, where in each step, (for example using a switch) you change the "timeframe" and "labels" and then you calculate the required arrays, draw the corresponding "box" and also add columns to the exploration.
If you need to store the individual calculated arrays for later processing you can assign them to some dynamically created variables. Again, search this forum for "dynamic variables" to learn from posted snippets/formulas.

The resulting code will be shorter and easier to maintain and modify!

4 Likes

@beppe, Yes you are correct but that will be a very difficult task for me.

Any other way to show the 1 M and 15 M in the explorer ?
Regards

you have to reverse the logic

i did the first one you do the rest .

i do not have data less then daily

on the chart
min 2

on explore

the code

/*
you have to revearce the logic

ec3
ec2
ec

*/
_SECTION_BEGIN("Unnamed 2");




P_EMA_a= 5; P_EMA_b= 13; P_EMA_c= 20;

//1m
EMA_a = EMA(C,P_EMA_a);
EMA_b  = EMA(C,P_EMA_b);
EMA_c  = EMA(C,P_EMA_c);


ec= IIf (SelectedValue( EMA_a) > SelectedValue( EMA_b) OR SelectedValue( EMA_a) < SelectedValue( EMA_b) ,EMA_a, 0);
ec2= IIf (SelectedValue( EMA_a) > SelectedValue( EMA_b) AND SelectedValue( EMA_a) > SelectedValue( EMA_c) ,EMA_a, 0);
ec3= IIf (SelectedValue( EMA_a) < SelectedValue( EMA_b) AND SelectedValue( EMA_a) < SelectedValue( EMA_c) ,EMA_a, 0);


wd_1m =
               WriteIf ( SelectedValue( ec3  ) , " Oe " ,
	           WriteIf ( SelectedValue( ec2 ) , " On " ,
               WriteIf ( SelectedValue( ec  )  , " One " ,
	           "x")));
	           
col_1m = 
	            IIf (SelectedValue( ec3  ), colorRed ,
	            IIf (SelectedValue( ec2  ), colorBrightGreen ,
	            IIf (SelectedValue( ec  ), colorGold , 
	            
	            colorDefault ))); 
	            
 col_1m_font = 
	            IIf (SelectedValue( ec3  ), colorWhite ,
	            IIf (SelectedValue( ec2  ), colorWhite ,
	            IIf (SelectedValue( ec ), colorWhite , 
	            
	            colorDefault ))); 

	            
 function TF_EMA_BOX( Text, x1, y1, x2, y2, BorderColor, BackColor , textcolor , fnt, fntsize, fntweight )
{
     GfxSetOverlayMode( 0 );
    // GfxSelectFont( "Tahoma", 9, 800 );
     GfxSelectFont( "fnt", fntsize, fntweight, 0, 0, 0 );
     GfxSelectPen( BorderColor ,3);
     GfxSetBkMode( 1 );
     GfxSelectSolidBrush( BackColor );
     GfxSetBkColor( BackColor );
     GfxSetTextColor( textcolor );
     GfxRectangle( x1, y1, x2, y2 );
     GfxDrawText( Text, x1, y1, x2, y2, 32 | 1 | 4);
}

procedure EMA_TF_CLC(Hor,Ver) {
	local  txt,textColor , bgColor;
	
	TF_EMA_BOX(""+wd_1m, Hor + 20   , Ver + 100 , Hor + 90 , Ver + 80, colorRed, col_1m, col_1m_font , "Tahoma", 9, 800 );

	// here add the rest of the boxs that you want them to in the chart
	
	}
	      
	Hor=Param("Horizontal Position",0, 0, 1980, 20);
    Ver=Param("Vertical Position",0, 0, 1024, 20);       
    EMA_TF = ParamToggle("Show EMA_TF", "No|Yes", 1);

if (EMA_TF) {

	
	EMA_TF_CLC(Hor +50 ,Ver + 100);
}

Filter = c ;

AddColumn(C,"Close");

AddColumn(RSI(14),"RSI-14",1.2, IIf(RSI(14) > Ref(RSI(14),-1), colorGreen, colorRed),-1);
AddColumn(ec,"1M",1.2, col_1m_font, col_1m,-1);

enjoy

here the code as Mr. beppe said

for the chart you will use SelectedValue()

for explore without SelectedValue() to use it for current and from-to date

there is another way as indicated by Mr. [beppe] in his answer and clarification of the method above

Sorry, this is my programming ability

this the code for both chart and explore

/*
you have to revearce the logic

ec3
ec2
ec

*/
_SECTION_BEGIN("Unnamed 2");




P_EMA_a= 5; P_EMA_b= 13; P_EMA_c= 20;

//1m
EMA_a = EMA(C,P_EMA_a);
EMA_b  = EMA(C,P_EMA_b);
EMA_c  = EMA(C,P_EMA_c);


ec= IIf (( EMA_a) > ( EMA_b) OR ( EMA_a) < ( EMA_b) ,EMA_a, 0);
ec2= IIf (( EMA_a) > ( EMA_b) AND ( EMA_a) > ( EMA_c) ,EMA_a, 0);
ec3= IIf (( EMA_a) < ( EMA_b) AND ( EMA_a) < ( EMA_c) ,EMA_a, 0);

/////////////////////////////////////// for  the explore  for the current Symbol    ///////////////////////////

///////////////////////////////////////////////////////////////////////////
wd_1m_exp =
               WriteIf (  ec3   , " Oe " ,
	           WriteIf (  ec2   , " On " ,
               WriteIf (  ec    , " One " ,
	           "x")));
	           
col_1m_exp = 
	            IIf ( ec3  , colorRed ,
	            IIf ( ec2  , colorBrightGreen ,
	            IIf ( ec   , colorGold , 
	            
	            colorDefault ))); 
	            
 col_1m_font_exp = 
	            IIf ( ec3  , colorWhite ,
	            IIf ( ec2  , colorWhite ,
	            IIf ( ec   , colorWhite , 
	            
	            colorDefault ))); 




/////////////////////////////////////// for  the chart or for explor with recent bar and all Symbols  ///////////////////////////

///////////////////////////////////////////////////////////////////////////
wd_1m_chr =
               WriteIf ( SelectedValue( ec3  ) , " Oe " ,
	           WriteIf ( SelectedValue( ec2 ) , " On " ,
               WriteIf ( SelectedValue( ec  )  , " One " ,
	           "x")));
	           
col_1m_chr = 
	            IIf (SelectedValue( ec3  ), colorRed ,
	            IIf (SelectedValue( ec2  ), colorBrightGreen ,
	            IIf (SelectedValue( ec  ), colorGold , 
	            
	            colorDefault ))); 
	            
 col_1m_font_chr = 
	            IIf (SelectedValue( ec3  ), colorWhite ,
	            IIf (SelectedValue( ec2  ), colorWhite ,
	            IIf (SelectedValue( ec ), colorWhite , 
	            
	            colorDefault ))); 

	            
 function TF_EMA_BOX( Text, x1, y1, x2, y2, BorderColor, BackColor , textcolor , fnt, fntsize, fntweight )
{
     GfxSetOverlayMode( 0 );
    // GfxSelectFont( "Tahoma", 9, 800 );
     GfxSelectFont( "fnt", fntsize, fntweight, 0, 0, 0 );
     GfxSelectPen( BorderColor ,3);
     GfxSetBkMode( 1 );
     GfxSelectSolidBrush( BackColor );
     GfxSetBkColor( BackColor );
     GfxSetTextColor( textcolor );
     GfxRectangle( x1, y1, x2, y2 );
     GfxDrawText( Text, x1, y1, x2, y2, 32 | 1 | 4);
}

procedure EMA_TF_CLC(Hor,Ver) {
	local  txt,textColor , bgColor;
	
	TF_EMA_BOX(""+wd_1m_chr, Hor + 20   , Ver + 100 , Hor + 90 , Ver + 80, colorRed, col_1m_chr, col_1m_font_chr , "Tahoma", 9, 800 );

	// here add the rest of the boxs that you want them to be in the chart
	
	}
	      
	Hor=Param("Horizontal Position",0, 0, 1980, 20);
    Ver=Param("Vertical Position",0, 0, 1024, 20);       
    EMA_TF = ParamToggle("Show EMA_TF", "No|Yes", 1);

if (EMA_TF) {

	
	EMA_TF_CLC(Hor +50 ,Ver + 100);
}

Filter = c ;

AddColumn(C,"Close");

AddColumn(RSI(14),"RSI-14",1.2, IIf(RSI(14) > Ref(RSI(14),-1), colorGreen, colorRed),-1);
AddColumn(ec,"1M",1.2, col_1m_font_exp, col_1m_exp,-1);