Simple Coding Help - No Promise.

amitrandive

Well-Known Member
thanks amit for ur help.

i already have afl running glitch free using ref(h,1)>=h as i add this after the buy condition.

=> My point is i want buy order on every bullish candle. If the next candle breaches the high of the bullish candle then buy is as it is, if it cant breach the high then it repaints and removes the buy signal.

Thanks
 

xsis

Active Member
sorry amit bro! this is not abt any pattern or having an exploration for it!
i have the exploration for the candle pattern. my BUY/SELL logic is totally different!
thks anyways!

Looks like a Harami pattern ,check if this helps.Use Scan ,do not explore

Code:
tf = Param( "TF", 70, 1, 100000, 1 ) ;
tfs = tf * in1Minute ;
TimeFrameSet( tfs ) ;
 
GraphXSpace=5;
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close",  colorBlack , styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
O1=Ref(O,-1);H1=Ref(H,-1);L1=Ref(L,-1);C1=Ref(C,-1);
O2=Ref(O,-2);H2=Ref(H,-2);L2=Ref(L,-2);C2=Ref(C,-2);
O3=Ref(O,-3);H3=Ref(H,-3);L3=Ref(L,-3);C3=Ref(C,-3);
BT=H2<H3 AND L2<L3 AND H1<H2 AND L1<L2;
ST=H2>H3 AND L2>L3 AND H1>H2 AND L1>L2;
 
 
LDB=C1>O1;LDS=C1<O1;
BULLHarami= O>C1 AND O<O1 AND C<O1 AND C>C1; //AND BT AND LDS;
BEARHarami= O<C1 AND O>O1 AND C>O1 AND C<C1; //AND ST AND LDB ;
Buy=BULLHARAMI;
Sell=BEARHARAMI;
//Short=Sell=bear;
//Cover=0;
//Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);
//Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,L,Offset=-10);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,Offset=-10);
//PlotShapes(IIf(Short, shapeHollowDownArrow , shapeNone), colorRed);
//PlotShapes(IIf(Cover, shapeHollowUpArrow , shapeNone), colorGreen);
 
TimeFrameRestore();
 

xsis

Active Member
dear coders

i reiterate tht this code which i am looking for is not abt any pattern exploration thingy! the logic is very clear and simple.

for a BEARISH SCENARIO:
1. previous candle (candle1) should be bullish candle (irrespective of the pattern).
2. candle2 should be bearish candle (irrespective of the pattern) in such a way that candle2 breaches high of candle1 and closes within the H-L range of candle1. also, it should give a negative close i.e. close<open

or a BULLISH SCENARIO:
1. previous candle (candle1) should be bearish candle (irrespective of the pattern).
2. candle2 should be bullish candle (irrespective of the pattern) in such a way that candle2 breaches low of candle1 and closes within the H-L range of candle1. also, it should give a positive close i.e. close>open

need your help forum!

dear coders - i have a simple request for an afl with exploration for buy & sell signals @eod. the logic is simple and explained in attached screenshots! here the respective SELL & BUY signals are generated in screenshot 1 & 2 respectively!



 
I have an exploration that gives me the current Buy/Sell signal.

I want to add to that the last generated Buy/Sell signal alongwith their date & data.

Any ideas?
 
Thanks, but my question was how to list the PREVIOUSLY generated Buy/Sell signal ALONGSIDE the CURRENT Buy/Sell signal.

I did try out on my own what you mentioned but that just gave me my entire list of stocks with signals that are older and not connected to the currently generated Buy/Sell...
 
Last edited:

amitrandive

Well-Known Member
Thanks, but my question was how to list the PREVIOUSLY generated Buy/Sell signal ALONGSIDE the CURRENT Buy/Sell signal.

I did try out on my own what you mentioned but that just gave me my entire list of stocks with signals that are older and not connected to the currently generated Buy/Sell...
Try two analysis windows with different parameters.
Or Define Buy1,Buy2,etc based on different time frames and explore for both
 
Last edited:

toughard

Well-Known Member
Hi friends I have this afl.....


/* Buy or Sell Condition */
Buy = Cross(Close,AA1);
Sell = Cross(BB1,Close);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

Filter = Buy OR Sell;
/* Exploration Parameters */
AddTextColumn( FullName(), "Company Name" );
AddColumn( Buy, "Buy", 1 );
AddColumn( Sell, "Sell", 1 );
AddColumn( C, "Close", 1.3 );
AddColumn( H, "High", 1.3 );


Title = EncodeColor(colorWhite)+ "JUST TIPS" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorYellow) +
" - " + Date() +" - "+"\n" +EncodeColor(colorRed) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite);//+

NOW TRYING FOR-


BuyPrice= ValueWhen(Cross(Close,xt),0,1);
SellPrice= ValueWhen(Cross(yt,Close),0,1);

WriteIf (Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf (Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","");

OR THIS-

GfxTextOut( ("Current P/L : " + WriteVal(IIf(Buy,(SellPrice-BuyPrice),(SellPrice-BuyPrice)),2.2)), 05, 80);

something NOT WORKING the P?L value is not showing correctlly...

can some one help??????
 

Similar threads