Need some one to add exploration to this afl

#1
Hi guys ,
pls add an exploration to this afl i need the exploration to show what color the previous candle was and what color the current candle is

This is the code
Code:
_SECTION_BEGIN("rdma spl");
_N(Title = StrFormat(EncodeColor( colorWhite) + "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
SetChartOptions(0,chartShowArrows|chartShowDates);

SetChartBkColor(colorBlack ) ;
ToolTip = "High = " + H + "\nOpen = " + O + "\nClose = " + C + "\nLow = " + L;


Col=IIf( C<MA(C,21) AND C<EMA(C,8) ,colorRed,IIf( C>MA(C,21) AND C>EMA(C,8),colorBlueGrey,IIf(( C<MA(C,21) AND C>EMA(C,8)) OR ( C>MA(C,21) AND C<EMA(C,8)) ,colorYellow,colorYellow)));
Plot( C, "Close", col, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
 
Plot(MA(Close,21), "MA1", colorYellow,styleLine|styleDashed|styleThick); 
Plot(MA(Close,55), "MA2", colorDarkRed,styleLine|styleDashed|styleThick); 
Plot(EMA(Close,8), "EMA1", colorBlue,styleLine|styleDashed|styleThick); 
Plot(EMA(Close,15), "EMA2", colorSkyblue,styleLine|styleDashed|styleThick);
_SECTION_END();
 
#2
try this

upt=C>MA(C,21) AND C>EMA(C,8);
dnt=C<MA(C,21) AND C<EMA(C,8);
nut=( C<MA(C,21) AND C>EMA(C,8)) OR ( C>MA(C,21) AND C<EMA(C,8));
Col=IIf(dnt ,colorRed,IIf( upt, colorBlueGrey,IIf(nut ,colorYellow,colorTan)));
Plot( C, "Close", col, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Filter=1;
AddColumn(C,"close",1.2,1,Col);
 

Attachments

#3
dude this is showing the color of todays candle only i want it to show the color of yesterdays candle also cuz the trading decision is taken by taking in consideration of previous candle also..short below red candle upon switch from yellow to red/blue to red and vice versa for longs(blue candle)
 
#4
dude this is showing the color of todays candle only i want it to show the color of yesterdays candle also cuz the trading decision is taken by taking in consideration of previous candle also..short below red candle upon switch from yellow to red/blue to red and vice versa for longs(blue candle)
Pls explain in details .

*
this exploration result shows , what was market
UP i.e [ C>MA(C,21) AND C>EMA(C,8) ]
DN i.e [C<MA(C,21) AND C<EMA(C,8) ]
Neutral i.e [ ( C<MA(C,21) AND C>EMA(C,8)) OR ( C>MA(C,21) AND C<EMA(C,8)) ]

even candle also plots as per above condition .

thank you
 
#5
cas bro coding for afl is right and its showing color but only for the days bar i want to knw wat was the color of previous days also since we must knw wat condition the previous day was to enter,we are looking to enter when neutral turn down or up OR when up turn down or vice versa...we dont want to enter fresh in the middle of a strong trend...This is how i want the exploration to look like ...i have added 2 additional columns if its ok

Ticker|current candle color|previous days candle color|Day's High|Day's Low
 
Last edited:

sr114

Well-Known Member
#6
cas bro coding for afl is right and its showing color but only for the days bar i want to knw wat was the color of previous days also since we must knw wat condition the previous day was to enter,we are looking to enter when neutral turn down or up OR when up turn down or vice versa...we dont want to enter fresh in the middle of a strong trend...This is how i want the exploration to look like ...i have added 2 additional columns if its ok

Ticker|current candle color|previous days candle color|Day's High|Day's Low
i think u need this

upt=C>MA(C,21) AND C>EMA(C,8);
dnt=C<MA(C,21) AND C<EMA(C,8);
nut=( C<MA(C,21) AND C>EMA(C,8)) OR ( C>MA(C,21) AND C<EMA(C,8));
Col=IIf(dnt ,colorRed,IIf( upt, colorBrightGreen,IIf(nut ,colorYellow,colorTan)));
Plot( C, "Close", col, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

upt1=Ref(C,-1)>Ref(MA(C,21),-1) AND Ref(C,-1)>Ref(EMA(C,8),-1);
dnt1=Ref(C,-1)<Ref(MA(C,21),-1) AND Ref(C,-1)<Ref(EMA(C,8),-1);
nut1=(Ref(C,-1)< Ref(MA(C,21),-1) AND Ref(C,-1)>Ref(EMA(C,8),-1)) OR ( Ref(C,-1)>Ref(MA(C,21),-1) AND Ref(C,-1)<Ref(EMA(C,8),-1));
Col=IIf(dnt1 ,colorRed,IIf( upt1, colorBrightGreen,IIf(nut1 ,colorYellow,colorTan)));

Filter=1 AND C>15;

AddColumn(Ref(C,-1),"Yestrdy LTP",1.2,1,Col);
AddColumn(C,"Today LTP ",1.2,1,Col);
AddColumn(H,"Today Hi ",1.2,1,colorBrightGreen);
AddColumn(L,"Today Lo ",1.2,1,colorOrange);
this will do the exploration, along the plotting.

rgds
subroto
 
Last edited:
#7
y days is coming nicely but today ltp candle color is not showing corectly bro now on 21st should be red but its showing yellow ...here's a snap of how it looks
 

sr114

Well-Known Member
#8
Col=IIf( C<MA(C,21) AND C<EMA(C,8) ,colorRed,IIf( C>MA(C,21) AND C>EMA(C,8),colorBlueGrey,
IIf(( C<MA(C,21) AND C>EMA(C,8)) OR ( C>MA(C,21) AND C<EMA(C,8)) ,colorYellow,colorYellow)));
the condition for the nutral candle is :

C<MA(C,21) AND C>EMA(C,8)) OR ( C>MA(C,21) AND C<EMA(C,8))

as u posted the code

so the exploration will act according the code and not as u wish

so if u want the get the color of the candle as previous day use proper logic and it will act accordingly

the present logic will do the same thing as it's logic

rgds
subroto
 

Similar threads