NF Swing Trading using Fractal AFL

oldtrader

Well-Known Member
alternatively please upload the csv file and provide link, I can try to split fields and resend...
Since there has been so much discussion on this topic. I need to clarify the position. The reason why I needed to split the cells was that I had 2 sets of data , I wanted to combine these 2 into a single data. I was thinking of manually merging the 2 data sets together, that is why the need for splitting the cells arose.

After doing some R&D I found a simple way of merging the data in Ami. Exported the 2 sets of data using the AFL posted. Then created a new data by using the Import Wizard in Ami.

Thanks to all you guys for trying to sort out the problem.
 
Since there has been so much discussion on this topic. I need to clarify the position. The reason why I needed to split the cells was that I had 2 sets of data , I wanted to combine these 2 into a single data. I was thinking of manually merging the 2 data sets together, that is why the need for splitting the cells arose.

After doing some R&D I found a simple way of merging the data in Ami. Exported the 2 sets of data using the AFL posted. Then created a new data by using the Import Wizard in Ami.

Thanks to all you guys for trying to sort out the problem.
Hey oldtrader,
Do you mean datafeed?
If you solved problem, let us know.

regards
mtftrader
 

aaru

Well-Known Member
hello OT..

i was thinking for past few days.. dont know much about optimization.. there is this 315 AFL which im posting here.. if we merge both, which has buy and sell signals embedded in it too.. TAKING ITS buy signal only if price above fractal.. and sell if below.. Point is we will reduce much loss / loss in profit (points already made) when it gives sell signal..,and we stay SOH ie leave our position and enter back when it shows buy again.., if the price lies above fractal level and vice versa..

tell me if u did not understand.. and i'm not sure if this can be optimized..

here s the code


_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}},{{VALUES}},\n Op - %g \n Hi - %g \n Lo - %g \n Cl - %g", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();


SetChartOptions(0,chartShowArrows|chartShowDates);
e1=EMA(C,3);
e2=EMA(C,15);
Plot(e1,"",colorBlue,styleThick);
Plot(e2,"",colorRed,styleThick );

Buy=Cross(e1,e2);
Sell=Cross(e2,e1);

Buysetup=Flip(Buy,Sell);
Shortsetup=Flip(Sell,Buy);
SHtrend=IIf(BarsSince(Buysetup)<BarsSince(Shortset up ),1,0);
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Buyt=ValueWhen(Buy,H,1);
Sellt=ValueWhen(Sell,L,1);
Buyt=IIf(SHtrend==1,Buyt,0);
Sellt=IIf(SHtrend==0,Sellt,0);
Buytt=Cross(H,Buyt)AND SHtrend==1;
selltt=Cross(Sellt,L)AND SHtrend==0;
Buytt = ExRem(Buytt, Selltt);
Selltt = ExRem(Selltt, Buytt);

PlotShapes(IIf(Buytt, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buytt, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buytt, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Selltt, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Selltt, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Selltt, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);



Col=IIf(SHtrend==1,colorGreen,4);
SetBarFillColor(Col);
Plot(C,"Close",Col,64);

ribboncol= IIf( BarsSince(Buysetup)<BarsSince(Shortsetup),colorGre en, colorRed ); //315 Trend
Plot(3, "SH315", ribboncol, styleArea | styleOwnScale | styleNoLabel, 0, 100 );


Title = EncodeColor(colorWhite)+ "SH 315" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +"\n" +EncodeColor(colorWhite) +"Open-"+O+" "+"High-"+H+" "+"Low-"+L+" "+EncodeColor(colorRed)+"Close-"+C+" " +EncodeColor(colorWhite)+ "Vol= "+ WriteVal(V)+EncodeColor(colorLime) +" EMA1 : "+e1+" "+EncodeColor(colorOrange) +" EMA2 : "+e2+" ";SetChartOptions(0,chartShowArrows|chartShowDates );
e1=EMA(C,3);
e2=EMA(C,15);
Plot(e1,"",colorWhite,styleThick);
Plot(e2,"",colorRed,styleThick );

Buy=Cross(e1,e2);
Sell=Cross(e2,e1);

Buysetup=Flip(Buy,Sell);
Shortsetup=Flip(Sell,Buy);
SHtrend=IIf(BarsSince(Buysetup)<BarsSince(Shortset up ),1,0);
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Buyt=ValueWhen(Buy,H,1);
Sellt=ValueWhen(Sell,L,1);
Buyt=IIf(SHtrend==1,Buyt,0);
Sellt=IIf(SHtrend==0,Sellt,0);
Buytt=Cross(H,Buyt)AND SHtrend==1;
selltt=Cross(Sellt,L)AND SHtrend==0;
Buytt = ExRem(Buytt, Selltt);
Selltt = ExRem(Selltt, Buytt);

PlotShapes(IIf(Buytt, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buytt, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buytt, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Selltt, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Selltt, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Selltt, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);



Col=IIf(SHtrend==1,colorGreen,4);
SetBarFillColor(Col);
Plot(C,"Close",Col,64);

ribboncol= IIf( BarsSince(Buysetup)<BarsSince(Shortsetup),colorGre en, colorRed ); //315 Trend
Plot(3, "SH315", ribboncol, styleArea | styleOwnScale | styleNoLabel, 0, 100 );


Title = EncodeColor(colorWhite)+ "SH 315" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +"\n" +EncodeColor(colorWhite) +"Open-"+O+" "+"High-"+H+" "+"Low-"+L+" "+EncodeColor(colorRed)+"Close-"+C+" " +EncodeColor(colorWhite)+ "Vol= "+ WriteVal(V)+EncodeColor(colorLime) +" EMA1 : "+e1+" "+EncodeColor(colorOrange) +" EMA2 : "+e2+" ";
 

oldtrader

Well-Known Member
Well oldtrader is not replying much..he/she is too busy with coding and back-testing..
I should have kept my id as buddatrader , instead of oldtrader, well I am a budda and not a buddi, so u can address me as he if you like.:D

Regarding the merging. I was thinking of taking entries when both the fractal and 315 conditions are satisfied and exit when either of the 2 conditions are met.
 

Similar threads