NF Swing Trading using Fractal AFL

oldtrader

Well-Known Member
#81
No offense. Just go through the following file -

http://www.filedropper.com/results_2

EMA crossover with few filters looks better than this. If fractal gives better results then I'll switch it immediately to it.. final outcome is very good in OldTrader but drawdown just doesnt provide me confidence enough to trade. If we can make it better then its a win win situation for all.

In the file you can see equity curve goes too quicky till july first week in EMA crossover than fractal(positive point). and also after july first week when market is flat, EMA crossover holds it pretty well whereas fractal actually goes down steeply.

Less system draw down means we can deploy more lots without loosing drastic sleep in the night. ;) so if we double the quantity then total profits from crossover becomes apprx 5400+ and max system drawdown becomes 742. Still less than fractal.


Hi denzo,

My way of looking at drawdown is slightly different than the conventional one. I look at it in terms of monthly losses. If the continous loss in any month is more than 250 points , I call it a loosing month. In my analysis of 108 months there were only 8 loosing months. And there were no back to back loosing months. And the maximum any loosing month went was upto 500 points.

By the time you encounter a loosing month you would have already accumulated sufficient points to tide over the losses.
 

oldtrader

Well-Known Member
#84
great work..post afls too so people can test it themselves too ..if not all..then at least top 10...
-
-
Here is the Second in the list
AFL Name = Supertrend
Parameters = 6.75 & 2
TF = 7 min


HTML:
* Done      by    Rajandran R */
/* Author of www.marketcalls.in  */

_SECTION_BEGIN("SuperTrend");
SetBarsRequired(100000,0);
GraphXSpace = 15;
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
GfxSetBkMode(0); 
GfxSetOverlayMode(1);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);

SetTradeDelays(1,1,1,1);

PositionSize = MarginDeposit = 1;
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Factor=Param("Factor",2,1,10,0.25);
Pd=Param("ATR Periods",11,1,100,0.5);
Up=(H+L)/2+(Factor*ATR(Pd));
Dn=(H+L)/2-(Factor*ATR(Pd));
iATR=ATR(Pd);
TrendUp=TrendDown=Null;
trend[0]=1;
changeOfTrend=0;
flag=flagh=0;

for (i = 1; i <BarCount-1; i++) {
      TrendUp[i] = Null;
      TrendDown[i] = Null;
     
      trend[i]=1;
   
      
      if (Close[i]>Up[i-1]) {
         trend[i]=1;
         if (trend[i-1] == -1) changeOfTrend = 1;
         
      }
      else if (Close[i]<Dn[i-1]) {
         trend[i]=-1;
         if (trend[i-1] == 1) changeOfTrend = 1;
      }
      else if (trend[i-1]==1) {
         trend[i]=1;
         changeOfTrend = 0;       
      }
      else if (trend[i-1]==-1) {
         trend[i]=-1;
         changeOfTrend = 0;
      }

      if (trend[i]<0 && trend[i-1]>0) {
         flag=1;
      }
      else {
         flag=0;
      }
      
      if (trend[i]>0 && trend[i-1]<0) {
         flagh=1;
      }
      else {
         flagh=0;
      }
      
      if (trend[i]>0 && Dn[i]<Dn[i-1]){
         Dn[i]=Dn[i-1];
		}
      
      if (trend[i]<0 && Up[i]>Up[i-1])
        { Up[i]=Up[i-1];
		}
      
      if (flag==1)
       {  Up[i]=(H[i]+L[i])/2+(Factor*iATR[i]);;
        } 
      if (flagh==1)
        { Dn[i]=(H[i]+L[i])/2-(Factor*iATR[i]);;
         }
      if (trend[i]==1) {
         TrendUp[i]=Dn[i];
         if (changeOfTrend == 1) {
            TrendUp[i-1] = TrendDown[i-1];
            changeOfTrend = 0;
         }
      }
      else if (trend[i]==-1) {
         TrendDown[i]=Up[i];
         if (changeOfTrend == 1) {
            TrendDown[i-1] = TrendUp[i-1];
            changeOfTrend = 0;
         }
      }
   } 

Plot(TrendUp,"Trend",colorGreen);
Plot(TrendDown,"Down",colorRed);

Buy = trend==1 ;
//Buy = trend==1;
Sell=trend==-1 ;
//Sell=trend==-1;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=Sell;
Cover=Buy;

//r1=AmiTradingSA();


BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
ShortPrice=ValueWhen(Short,C);
CoverPrice=ValueWhen(Cover,C);


Title = EncodeColor(colorWhite)+ "Super Trend AFL code from www.marketcalls.in" + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
 "  - " + 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(colorYellow)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy  , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","");

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

TrendSL=IIf(trend==1,TrendUp,TrendDown);

for(i=BarCount-1;i>1;i--)
{
if(Buy[i] == 1)
{
entry = C[i];
sig = "BUY";
sl = TrendSL[i];
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);
 
bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "SELL";
entry = C[i];
sl = TrendSL[i];
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);
 
 
bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, TrendSL[BarCount-1], Ref(TrendSL, -1));
sl = ssl[BarCount-1];
 

Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

//Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset);
//Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset);

/* 
for (i=bars; i <BarCount;i++)
{
PlotText(""+sig+"@"+entry, BarCount-5,entry,Null,colorBlue);
PlotText("T1@"+tar1,BarCount-5,tar1,Null,Clr);PlotText("T2@"+tar2,BarCount-5,tar2,Null,Clr);PlotText ("T3@"+tar3,BarCount-5,tar3,Null,Clr);
 
}*/
 
messageboard = ParamToggle("Message Board","Show|Hide",1);
if (messageboard == 1 )
{
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );
 
if ( sig =="BUY")
{
GfxSelectSolidBrush( colorBlue ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 290;
 
y = pxHeight;
 
GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 98, x2, y , 7, 7 ) ;
GfxTextOut( ( "Marketcalls - Supertrend"),13,y-100);
GfxTextOut( (" "),27,y-100);
GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 13, y-80) ; // The text format location
GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 13, y-60);
GfxTextOut( ("Trailing SL : " + Ref(TrendSL,-1) + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 13, y-40);
/*GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);*/
GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 13, y-22);;




//Magfied Market Price
//FS=Param("Font Size",30,11,100,1);
//GfxSelectFont("Times New Roman", FS, 700, True ); 
//GfxSetBkMode( colorWhite );  
//GfxSetTextColor( ParamColor("Color",colorGreen) ); 
//Hor=Param("Horizontal Position",940,1,1200,1);
//Ver=Param("Vertical Position",12,1,830,1); 
//GfxTextOut(""+C, Hor , Ver );
//YC=TimeFrameGetPrice("C",inDaily,-1);
//DD=Prec(C-YC,2);
//xx=Prec((DD/YC)*100,2);
//GfxSelectFont("Times New Roman", 11, 700, True ); 
//GfxSetBkMode( colorBlack );  
//GfxSetTextColor(ParamColor("Color",colorYellow) ); 
//GfxTextOut(""+DD+"  ("+xx+"%)", Hor , Ver+45 );
 
}

_SECTION_END();

_SECTION_BEGIN("Time Left");
//function GetSecondNum()
//{
//Time = Now( 4 );
//Seconds = int( Time % 100 );
//Minutes = int( Time / 100 % 100 );
//Hours = int( Time / 10000 % 100 );
//SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
//return SecondNum;
//}
//RequestTimedRefresh( 1 );
//TimeFrame = Interval();
//SecNumber = GetSecondNum();
//Newperiod = SecNumber % TimeFrame == 0;
//SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
//SecsToGo = TimeFrame - SecsLeft;

//x=Param("xposn",50,0,1000,1);
//y=Param("yposn",380,0,1000,1);

//GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) );
//GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 );
//if ( NewPeriod )
//{
//GfxSelectSolidBrush( colorYellow );
//GfxSelectPen( colorYellow, 2 );
//Say( "New period" );
//}
//GfxRoundRect( x+45, y+40, x-3, y-2, 0, 0 );
//GfxSetBkMode(1);
//GfxSelectFont( "Arial", 14, 700, False );
//GfxSetTextColor( colorRed );
//GfxTextOut( "Time Left :"+SecsToGo+"", x, y );

GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 2, 30, 55, 50, 9, 9 ) ;
GfxSelectFont("romans", 9, 700 ); 
GfxTextOut(" SUPER", 5, 32);



GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 65, 30, 130,52, 9, 9 ) ;
GfxSelectFont("romans", 12, 700 ); 
GfxTextOut( ""+C, 70, 30);


GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 135, 30, 280, 55, 9, 9 ) ;
GfxSelectFont("romans", 9, 700 ); 
//GfxTextOut("" +Date() , 140, 32);
GfxTextOut(" NF 6.75 2", 140, 32);
_SECTION_END();
Pls find attached chart for the above AFL

 

suri112000

Well-Known Member
#85
This is the coding I have been looking all these years. If anyone have this AFL, please post. Grabbing of 100 points of Nifty on monthly basis is easy with this system with some filters.

 
Last edited:

vijayanscbe

Well-Known Member
#86
Dear Oldtraderji,
Please excuse me for this post.

I severely doubt OPTIMIZATION for backtesting! Optimization simply gives BEST FIT curve for the look back period. As you are putting so much of your energy for backtesting, please consider following.

Yes, I agree that entire logic of TA is that price action is repeating. But the problem with OPTIMIZATION is that, it wants to say "Price Action is Repeating AS IT IS!" That is the big problem. So till backtesting we get good results, but then horror starts.

My suggestion:
1. Optimize for 2006 and with those parameters chech results for further years
2. Repeat step 1 for all years. Like Optimize for only 2007 data and then check results for all years ....

We will see HUGE VARIATIONS!
I second this,

I had done tons and tons of back-testing with lot of optimisation, before knowing the what is meant by Curve Fitting ?.

Take some logical variables and do back-testing with different data samples, different time frames, different asset classes. Results should have positive expectancy in all.

Dont change the variables to get extra profits/reduce loss, this is the loop hole for failure, sooner or later. Instead you can use some price-action discretions.
 

suri112000

Well-Known Member
#87
I second this,

I had done tons and tons of back-testing with lot of optimisation, before knowing the what is meant by Curve Fitting ?.

Take some logical variables and do back-testing with different data samples, different time frames, different asset classes. Results should have positive expectancy in all.

Dont change the variables to get extra profits/reduce loss, this is the loop hole for failure, sooner or later. Instead you can use some price-action discretions.
I agree with you. The failure of mechanical system is due to the fact that it is based on past data and expecting it to perform into future. Many participants of the market are using past data to do analysis either with programmes or manual analysis and devising ways to profit from them. When their programmes or analysis fail to deliver, they make changes to the programme (optimisation or parameter changes) or analysis (expanded or shrinked cycles) or simply they stop trading altogether and look for another system or programme which is fitting into the present market conditions. These changes will adversely affect the market profile. In a way, the buying/selling pressure builds at different levels compared to previous market profile. But the unchanged programme (ie purely mechanical system) does not take into consideration this changed market profile into consideration, and continues to treat the past data as it used to and provide signals which ought to fail due to changed market profile.

The best way to counter this is to select a timeframe and programme/AFL which delivers in the long run and club it with some price action set ups to consider change in market profiles.
 

vikas2131

Well-Known Member
#88
-
-
Here is the Second in the list
AFL Name = Supertrend
Parameters = 6.75 & 2
TF = 7 min


HTML:
* Done      by    Rajandran R */
/* Author of www.marketcalls.in  */

_SECTION_BEGIN("SuperTrend");
SetBarsRequired(100000,0);
GraphXSpace = 15;
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
GfxSetBkMode(0); 
GfxSetOverlayMode(1);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);

SetTradeDelays(1,1,1,1);

PositionSize = MarginDeposit = 1;
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Factor=Param("Factor",2,1,10,0.25);
Pd=Param("ATR Periods",11,1,100,0.5);
Up=(H+L)/2+(Factor*ATR(Pd));
Dn=(H+L)/2-(Factor*ATR(Pd));
iATR=ATR(Pd);
TrendUp=TrendDown=Null;
trend[0]=1;
changeOfTrend=0;
flag=flagh=0;

for (i = 1; i <BarCount-1; i++) {
      TrendUp[i] = Null;
      TrendDown[i] = Null;
     
      trend[i]=1;
   
      
      if (Close[i]>Up[i-1]) {
         trend[i]=1;
         if (trend[i-1] == -1) changeOfTrend = 1;
         
      }
      else if (Close[i]<Dn[i-1]) {
         trend[i]=-1;
         if (trend[i-1] == 1) changeOfTrend = 1;
      }
      else if (trend[i-1]==1) {
         trend[i]=1;
         changeOfTrend = 0;       
      }
      else if (trend[i-1]==-1) {
         trend[i]=-1;
         changeOfTrend = 0;
      }

      if (trend[i]<0 && trend[i-1]>0) {
         flag=1;
      }
      else {
         flag=0;
      }
      
      if (trend[i]>0 && trend[i-1]<0) {
         flagh=1;
      }
      else {
         flagh=0;
      }
      
      if (trend[i]>0 && Dn[i]<Dn[i-1]){
         Dn[i]=Dn[i-1];
		}
      
      if (trend[i]<0 && Up[i]>Up[i-1])
        { Up[i]=Up[i-1];
		}
      
      if (flag==1)
       {  Up[i]=(H[i]+L[i])/2+(Factor*iATR[i]);;
        } 
      if (flagh==1)
        { Dn[i]=(H[i]+L[i])/2-(Factor*iATR[i]);;
         }
      if (trend[i]==1) {
         TrendUp[i]=Dn[i];
         if (changeOfTrend == 1) {
            TrendUp[i-1] = TrendDown[i-1];
            changeOfTrend = 0;
         }
      }
      else if (trend[i]==-1) {
         TrendDown[i]=Up[i];
         if (changeOfTrend == 1) {
            TrendDown[i-1] = TrendUp[i-1];
            changeOfTrend = 0;
         }
      }
   } 

Plot(TrendUp,"Trend",colorGreen);
Plot(TrendDown,"Down",colorRed);

Buy = trend==1 ;
//Buy = trend==1;
Sell=trend==-1 ;
//Sell=trend==-1;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=Sell;
Cover=Buy;

//r1=AmiTradingSA();


BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
ShortPrice=ValueWhen(Short,C);
CoverPrice=ValueWhen(Cover,C);


Title = EncodeColor(colorWhite)+ "Super Trend AFL code from www.marketcalls.in" + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
 "  - " + 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(colorYellow)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy  , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","");

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

TrendSL=IIf(trend==1,TrendUp,TrendDown);

for(i=BarCount-1;i>1;i--)
{
if(Buy[i] == 1)
{
entry = C[i];
sig = "BUY";
sl = TrendSL[i];
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);
 
bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "SELL";
entry = C[i];
sl = TrendSL[i];
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);
 
 
bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, TrendSL[BarCount-1], Ref(TrendSL, -1));
sl = ssl[BarCount-1];
 

Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

//Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset);
//Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset);

/* 
for (i=bars; i <BarCount;i++)
{
PlotText(""+sig+"@"+entry, BarCount-5,entry,Null,colorBlue);
PlotText("T1@"+tar1,BarCount-5,tar1,Null,Clr);PlotText("T2@"+tar2,BarCount-5,tar2,Null,Clr);PlotText ("T3@"+tar3,BarCount-5,tar3,Null,Clr);
 
}*/
 
messageboard = ParamToggle("Message Board","Show|Hide",1);
if (messageboard == 1 )
{
GfxSelectFont( "Tahoma", 13, 100 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );
 
if ( sig =="BUY")
{
GfxSelectSolidBrush( colorBlue ); // this is the box background color
}
else
{
GfxSelectSolidBrush( colorRed ); // this is the box background color
}
pxHeight = Status( "pxchartheight" ) ;
xx = Status( "pxchartwidth");
Left = 1100;
width = 310;
x = 5;
x2 = 290;
 
y = pxHeight;
 
GfxSelectPen( colorGreen, 1); // broader color
GfxRoundRect( x, y - 98, x2, y , 7, 7 ) ;
GfxTextOut( ( "Marketcalls - Supertrend"),13,y-100);
GfxTextOut( (" "),27,y-100);
GfxTextOut( ("Last " + sig + " Signal came " + (BarCount-bars-1) * Interval()/60 + " mins ago"), 13, y-80) ; // The text format location
GfxTextOut( ("" + WriteIf(sig =="BUY",sig + " @ ",sig + " @") + " : " + entry), 13, y-60);
GfxTextOut( ("Trailing SL : " + Ref(TrendSL,-1) + " (" + WriteVal(IIf(sig == "SELL",entry-sl,sl-entry), 2.2) + ")"), 13, y-40);
/*GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);
GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);
GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);*/
GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == "BUY",(C-entry),(entry-C)),2.2)), 13, y-22);;




//Magfied Market Price
//FS=Param("Font Size",30,11,100,1);
//GfxSelectFont("Times New Roman", FS, 700, True ); 
//GfxSetBkMode( colorWhite );  
//GfxSetTextColor( ParamColor("Color",colorGreen) ); 
//Hor=Param("Horizontal Position",940,1,1200,1);
//Ver=Param("Vertical Position",12,1,830,1); 
//GfxTextOut(""+C, Hor , Ver );
//YC=TimeFrameGetPrice("C",inDaily,-1);
//DD=Prec(C-YC,2);
//xx=Prec((DD/YC)*100,2);
//GfxSelectFont("Times New Roman", 11, 700, True ); 
//GfxSetBkMode( colorBlack );  
//GfxSetTextColor(ParamColor("Color",colorYellow) ); 
//GfxTextOut(""+DD+"  ("+xx+"%)", Hor , Ver+45 );
 
}

_SECTION_END();

_SECTION_BEGIN("Time Left");
//function GetSecondNum()
//{
//Time = Now( 4 );
//Seconds = int( Time % 100 );
//Minutes = int( Time / 100 % 100 );
//Hours = int( Time / 10000 % 100 );
//SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
//return SecondNum;
//}
//RequestTimedRefresh( 1 );
//TimeFrame = Interval();
//SecNumber = GetSecondNum();
//Newperiod = SecNumber % TimeFrame == 0;
//SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
//SecsToGo = TimeFrame - SecsLeft;

//x=Param("xposn",50,0,1000,1);
//y=Param("yposn",380,0,1000,1);

//GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) );
//GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 );
//if ( NewPeriod )
//{
//GfxSelectSolidBrush( colorYellow );
//GfxSelectPen( colorYellow, 2 );
//Say( "New period" );
//}
//GfxRoundRect( x+45, y+40, x-3, y-2, 0, 0 );
//GfxSetBkMode(1);
//GfxSelectFont( "Arial", 14, 700, False );
//GfxSetTextColor( colorRed );
//GfxTextOut( "Time Left :"+SecsToGo+"", x, y );

GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 2, 30, 55, 50, 9, 9 ) ;
GfxSelectFont("romans", 9, 700 ); 
GfxTextOut(" SUPER", 5, 32);



GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 65, 30, 130,52, 9, 9 ) ;
GfxSelectFont("romans", 12, 700 ); 
GfxTextOut( ""+C, 70, 30);


GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 135, 30, 280, 55, 9, 9 ) ;
GfxSelectFont("romans", 9, 700 ); 
//GfxTextOut("" +Date() , 140, 32);
GfxTextOut(" NF 6.75 2", 140, 32);
_SECTION_END();
Pls find attached chart for the above AFL

thanks..can you post all of it in one go :)
 

oldtrader

Well-Known Member
#89
thanks..can you post all of it in one go :)
-
-
Here they are all of them



3rd in the list
Name of AFL = Asnavale
TF = 5 min
Param = 89

HTML:
_SECTION_BEGIN("Background_Setting");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),
ParamColor("BgBottom", colorDarkGrey),ParamColor("TitleBack",colorGrey40) ); 
SetChartBkColor(ParamColor("Outer Panel",colorPaleBlue));
_SECTION_END();
Plot( Close, "", colorBlack, styleCandle, styleThick );
_SECTION_BEGIN("SingleMA");

SetChartOptions(0, chartShowDates | chartWrapTitle);

Type = ParamList("Average Type", "Wilders,SMA,EMA");
P = Param("Averaging Period", 20, 3, 100,1);
Q = Param("%Change", 1, 0.1, 10, 0.1);
BP = Param("BB Period", 20, 3, 100);
BW = Param("BB Width", 2, 0.5, 10, 0.5);
BBOption = ParamToggle("Plot BB", "No I Yes");

Report = ParamList("Trigs or Update or Tgt-SL?", "Triggers|Update|Tgt-SL");

if(Type == "Wilders") A = Wilders(C, P);
if(Type == "SMA") A = MA(C, P);
if(Type == "EMA") A = EMA(C, P);

SL = Max(LLV(L, 5), Trough(L, Q, 1));

Tgt = 2 * H - SL;
MeanPrice = Prec((O + C) / 2, 2);

Part = 100 * (H - A) / (H - L);

BBTop = BBandTop(C, BP, BW);
BBBot = BBandBot(C, BP, BW);

Buy = (Prec(C, 2) > Prec(A, 2)) AND Part > 70;
Sell = H < A;
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Bought = Flip(Buy, Sell);
Sold = Flip(Sell, Buy);
NextTgt = ValueWhen(Buy, Tgt, 1);

for(i = 1; i < BarCount; i++)
{
"if(Bought AND NOT Buy)";
{
SL = Max(SL, SL[i - 1]);
if(C[i - 1] >= 0.9999 * NextTgt[i - 1]) NextTgt = Tgt[i - 1];
NextTgt = Max(NextTgt, NextTgt[i - 1]);
} 
}
BuyDate = ValueWhen(Buy, Ref(DateTime(), 1), 1);
BuyPrice = ValueWhen(Buy, Ref(MeanPrice, 1), 1);
SellPrice = ValueWhen(Sell, Ref(MeanPrice, 1), 1);

TgtReached = IIf(Bought AND NOT Buy AND C >= 0.9999 * NextTgt, True, False);
SLHit = IIf(Bought AND NOT Buy AND C < SL, True, False);
SLHit = ExRem(SLHit, Buy);
//
if(TgtReached[BarCount - 1]) NextTgt[BarCount - 1] = 2 * H[BarCount -1] - SL[BarCount - 1];
//
if(Status("action") == actionIndicator)
{
Ttl = EncodeColor(colorTurquoise) + "Single MA system," + "\n"
+ WriteIf(Buy, EncodeColor(colorGreen) + "Buy Triggered Today, Buy this stock Tomorrow.","")
+ WriteIf(Sell, EncodeColor(colorRed) + "Sell Triggered Today, Sell This stock Tomorrow.", "")
+ EncodeColor(colorTan) + WriteIf(Bought AND NOT Buy, "Bought @ " + BuyPrice + ". "
+ "Target Price = " + NextTgt + ", Stop Loss = " + SL + ".\n"
+ WriteIf(TgtReached, "Target Reached. Next Target = " + Ref(NextTgt, 1) + ".\n", "")
+ EncodeColor(colorGold) + "Profit / Loss so far = " + Prec(100 * (C - BuyPrice) / BuyPrice, 2) + "%", "")
+ WriteIf(Sold AND NOT Sell, "Sold @ " + SellPrice + "\nProfit / Loss in Previous Trade = " + Prec(100 * (SellPrice - BuyPrice) / BuyPrice, 2) + "%", "");

_N(Title = StrFormat("{{NAME}} ({{INTERVAL}}), {{DATE}} ; {{OHLCX}}, V=%1.0f\n {{VALUES}}\n\n", V) + Ttl);
ChartStyle = ParamStyle("Chart Type", styleBar, maskAll);

//PlotOHLC(O, H, L, C, "", colorLightGrey, ChartStyle);
Plot(A, Type + "(" + P +")", colorRed, styleLine | styleThick);
Plot(IIf(Bought, NextTgt, Null), "Target", colorBlueGrey, styleLine);
Plot(SL, "Trail SL", colorTeal, styleLine);
//PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-20);
//PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-30);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorBlack, 0,L, Offset=-25);
//PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
//PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorBlack, 0,H, Offset=-25);
if(BBOption) Plot(BBtop, "BB-Top", colorPink, styleLine);
if(BBOption) Plot(BBBot, "BB-Bot", colorPink, styleLine);
}

if((Status("action") == actionExplore) AND Report == "Triggers")
{
Filter = Buy OR Sell;

SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol", 77, colorDefault, colorDefault, 120);
AddColumn(DateTime(), "Trigger Date", formatDateTime);
AddColumn(IIf(Buy, 66, 83), "Signal", formatChar, colorYellow, IIf(Buy, colorGreen, colorRed));
AddColumn(C, "C. M. P.", 6.2);
AddColumn(IIf(Buy OR Bought, NextTgt, Null), "Target", 6.2);
AddColumn(IIf(Buy OR Bought, SL, Null), "StopLoss", 6.2);
}
if((Status("action") == actionExplore) AND Report == "Update")
{
Filter = True;

SetOption("NoDefaultColumns", True);

AddColumn(DateTime(), "Updated On", formatDateTime, colorDefault, colorDefault, 96);
AddTextColumn(Name(), "Symbol", 77, colorDefault, colorDefault, 120);
AddColumn(BuyDate, "Buy Date", formatDateTime, colorDefault, colorDefault, 96);
AddColumn(BuyPrice, "Buy Price", 6.2);
AddColumn(NextTgt, "Target", 6.2);
AddColumn(SL, "StopLoss", 6.2);
AddColumn(C, "CMP", 6.2, colorDefault, colorDefault, 96);
}
if((Status("action") == actionExplore) AND Report == "Tgt-SL")
{
Filter = TgtReached OR SLHit;

SetOption("NoDefaultColumns", True);

AddColumn(DateTime(), "Updated On", formatDateTime, colorDefault, colorDefault, 96);
AddTextColumn(Name(), "Symbol", 77, colorDefault, colorDefault, 120);
AddColumn(BuyDate, "Buy Date", formatDateTime, colorDefault, colorDefault, 96);
AddColumn(BuyPrice, "Buy Price", 6.2);
AddColumn(NextTgt, "Target", 6.2);
AddColumn(SL, "StopLoss", 6.2);
AddColumn(C, "CMP", 6.2, colorDefault, colorDefault, 96);
AddColumn(IIf(TgtReached, 89, 32), "Tgt Hit?", formatChar, colorYellow, IIf(TgtReached, colorGreen, colorDefault));
AddColumn(IIf(TgtReached, 2 * H - SL, Null), "Next Tgt", 1.2);
AddColumn(IIf(SLHit, 89, 32), "SL-Hit", formatChar, colorYellow, IIf(SLHit, colorRed, colorDefault));
} 

dist = 2.0*ATR(20); 

for( i = 0; i < BarCount; i++ ) 
{ 
//if( Buy[i] ) PlotText( "Buy\n@" + C[ i ]+"\n sl :"+ValueWhen( supbase==Base, LLV(L,HHVperiod) ) , i, L[ i ]-dist[i], colorBlack,colorGreen ); 
//if( Short[i] ) PlotText( "Sell\n@" + C[ i ]+"\n sl :"+ ValueWhen( ResBase==Base, HHV(H,HHVperiod) ), i, H[ i ]+dist[i], colorBlack, colorRed ); 
if( Buy[i] ) PlotText( "Buy\n@" + C[ i ] , i, L[ i ]-dist[i], colorBlack,colorWhite ); 
if( Sell[i] ) PlotText( "Sell\n@" + C[ i ], i, H[ i ]+dist[i], colorBlack, colorWhite ); 


}

t1= Flip(Buy,Sell);
t2= Flip(Sell,Buy);
BPrice=ValueWhen(t1 AND Ref(t1,-1)==0,C,1);
SPrice=ValueWhen(t2 AND Ref(t2,-1)==0,C,1);

Buyplus1=(Bprice+150);
Buyplus2=(Bprice+200);
Buyplus3=(Bprice+250);
//Buyminus=(Bprice-40);
Plot(Buyplus1,"R1",colorBlue,styleDots|styleThick|styleNoTitle);
Plot(Buyplus2,"R1",colorBlue,styleDots|styleThick|styleNoTitle);
Plot(Buyplus3,"R1",colorBlue,styleDots|styleThick|styleNoTitle);
//Plot(Buyminus,"R2",colorBlue,styleDots|styleThick|styleNoTitle);

//Sellplus=(Sprice+40);
Sellminus1=(Sprice-150);
Sellminus2=(Sprice-200);
Sellminus3=(Sprice-250);
//Plot(Sellplus,"R3",colorBlack,styleDots|styleThick|styleNoTitle);
Plot(Sellminus1,"R4",colorBlack,styleDots|styleThick|styleNoTitle);
Plot(Sellminus2,"R4",colorBlack,styleDots|styleThick|styleNoTitle);
Plot(Sellminus3,"R4",colorBlack,styleDots|styleThick|styleNoTitle);

GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 2, 15, 95, 35, 9, 9 ) ;
GfxSelectFont("romans", 9, 700 ); 
GfxTextOut("      A  S  N  V", 5, 18);

GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 100, 15, 200,42, 9, 9 ) ;
GfxSelectFont("romans", 18, 700 ); 
GfxTextOut( ""+C, 110, 13);


GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 205, 15, 330, 35, 9, 9 ) ;
GfxSelectFont("romans", 9, 700 ); 
GfxTextOut("" +Date() , 210, 18);

//////////////////////////////////////////////////
// Calculate the Last Five Trades Profit/Losses //
//////////////////////////////////////////////////

tradesback = 5; 
Signum = Cum( Buy ) + Cum( Sell ); 
Signumstart1 = LastValue( SigNum ) - ( tradesback - 1 ); 
Signumstart2 = LastValue( SigNum ) - ( tradesback - 2 ); 
Signumstart3 = LastValue( SigNum ) - ( tradesback - 3 ); 
Signumstart4 = LastValue( SigNum ) - ( tradesback - 4 ); 
Signumstart5 = LastValue( SigNum ) - ( tradesback - 5 ); 

bi = BarIndex(); 
bistart = ValueWhen( signum == signumstart1, bi ); 
bicond = bi >= bistart AND bi <= LastValue( bi ); 


SellPL = IIf( Sell AND bicond, C-BuyPrice, 0 ); 
CovPL = IIf( Sell AND bicond, ShortPrice - C,0 ); 

cumPL = SellPL + CovPL;

//Plot (SellPL,"Sell",colorGreen,styleHistogram,maskhistogram);
///Plot (CovPL,"Cover", colorRed,styleHistogram,maskhistogram);

lsince = LowestSince(Sell OR Sell, cumPL, 0);	
hsince = HighestSince(Sell OR Sell, CumPL, 0);


vs= IIf(lsince==0,hsince,lsince);


PL1 = ValueWhen( signum == signumstart1 , vs,1 );
PL2 = ValueWhen( signum == signumstart2 , vs,1 ); 
PL3 = ValueWhen( signum == signumstart3 , vs,1 );  
PL4 = ValueWhen( signum == signumstart4 , vs,1 ); 
PL5 = ValueWhen( signum == signumstart5,  vs ,1 ); 

//////////////////////////////////////////////////
//   Plot the Last Five Trades Profit/Losses    //
//////////////////////////////////////////////////


Title = EncodeColor(colorWhite)+ "Backtest Results  from www.marketcalls.in" + "
- " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) +
EncodeColor(colorWhite) +

 "  - " + Date() +" - "+"\n" +EncodeColor(colorRed) +"Op-"+O+"  "+"Hi-"+H+" 
"+"Lo-"+L+"  "+

"Cl-"+C+"  "+ "Vol= "+ WriteVal(V)+"\n"+ EncodeColor(colorYellow)+ "\n\n\nLast 5
Trade Results\n" +
"\nTrade1= " + PL1
+"\n"+ "Trade2= " + CovPL
+"\n"+ "Trade3= " + PL3
+"\n"+ "Trade4= " + PL4
+"\n"+ "Trade5= " + PL5;
-
-
4th in the list is St wst
Already posted


-
-
5th in the list
Name of AFL = Linkon
TF = 15 min
Param = 20 34 20


HTML:
_SECTION_BEGIN("MACD");
SetChartBkColor( colorWhite ) ; 

SetChartBkGradientFill( ParamColor("Inner panel upper",colorWhite),ParamColor("Inner panel lower",colorLightYellow));
//Title = ("L   I    N    K    O    N \n" + Name()+"  " + Date() +"  "+Interval(2) +" \n"+ EncodeColor(colorBlack)+"Open "+Open +" ,High "+H+" ,Low "+L+" ,Close "+C+" "+"{{VALUES}}");


r1 = Param( "Fast avg", 11, 3, 20, 1 );
r2 = Param( "Slow avg", 35, 10, 35, 1 ); 
r3 = Param( "Signal avg", 6, 3, 20, 1 ); 
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hst = ml-sl;

A1=EMA(C,4)-EMA(C,34); 
BBtops=BBandTop(A1,10,1); 
BBbots=BBandBot(A1,10,1);

//Color_bar=IIf(a1<0 AND a1>Ref(a1,-1), colorAqua,IIf(a1>0 AND a1>Ref(a1,-1),colorBlue,IIf(a1>0 AND a1<Ref(a1,-1),colorOrange,colorRed)));
Color_bar=IIf(a1>BBtops, colorBlue,IIf(a1<BBbots,colorRed,colorYellow));

//Plot( ml = MACD(3, 11), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") );
//Plot( sl = Signal(3,11,16), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") );
bbtop = BBandTop( Hst, 10, 1 );
bbbot = BBandBot( Hst, 10,1 );
//Plot( BBandTop( Hst, 9, 1 ), "BBTop", colorYellow, styleDashed ); 
//Plot( BBandBot( Hst, 9,1 ), "BBBot", colorYellow, styleDashed ); 

Color = IIf (Hst > BBtop,colorBlue,IIf(hst < bbbot,colorRed, colorYellow));
//Plot( Hst, "secret",  color , styleThick  );
/*
Buy = Cross (Hst,bbtop);
Sell = Cross (bbtop,Hst);
Short = Cross (bbbot,Hst);
Cover = Cross (Hst,bbbot);
*/ 
band = Param("band",10,1,40,1);
//Buy = Color == colorBlue AND Close > EMA(High,band);
//Short = color== colorRed AND Close < EMA (Low,band);
Buy = Color == colorBlue AND Color_bar==colorBlue AND Close > EMA(High,band);
Short = color== colorRed AND Color_bar == colorRed AND Close < EMA (Low,band);

Buy = ExRem(Buy, Short);
Short = ExRem(Short, Buy);

Sell = Short;
Cover = Buy ;

Hi = EMA(High,band);
Lo = EMA(Low,band);
//PlotShapes (Buy*shapeUpArrow,colorYellow);
//PlotShapes (Short*shapeDownArrow,colorYellow);
//PlotShapes (Sell*shapeHollowCircle,colorRed);
//PlotShapes (Cover*shapeHollowCircle,colorGreen);
//Plot (Close,"close",Color_bar,styleCandle);
Plot( Close, "", colorBlack, styleCandle, styleThick );
Plot (Hi,"upper band",colorWhite,styleDashed);
Plot (Lo,"lower band",colorWhite,styleDashed);


//Plot(6, "", Color, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
_SECTION_END();

_SECTION_BEGIN("Support & Resistance"); 
//Support and resistance levels using RSI. 
//graham Kavanagh May 2003
//Load into Indicator Builder
//Sensitivity of the levels can be changed with the variables
//Can test different numbers live with the Param function ctrl-R with open pane
RSIperiod	= 5;	// Param("RSI p",3,14,30,1);
Percent 		= 5;	//	Param("ZIG %",8,9,15,1);
EMAperiod 	= 5;	//Param("EMA p",4,5,10,1);
HHVperiod 	= 5;	//Param("HHV p",3,5,10,1);
NumLine 		= 1;	//Param("Num Lines",3,1,20,1);

Base = DEMA(RSI(RSIperiod),EMAperiod);

//GraphXSpace=0.5;
//Plot(C,"",colorWhite,styleCandle);

for( i = 1; i <= numline; i++ )
{
ResBase = LastValue(Peak(Base,Percent,i));
SupBase = LastValue(Trough(Base,Percent,i));
Plot(ValueWhen( ResBase==Base, HHV(H,HHVperiod) ), "Resist Level", colorRed, styleLine);
Plot(ValueWhen( supbase==Base, LLV(L,HHVperiod) ), "Support Level", colorGreen, styleLine);
}
//Title = Name() + "; " + Date() + ": Support & Resistance Levels using RSI: " + /*EncodeColor(colorGreen)+ "Support Levels are Green; "+EncodeColor(colorRed)+ "Resistance Levels are Red: "+EncodeColor(colorBlack)+*/ "Num lines ="+WriteVal(numline,1) ; 
 


dist = 1.0*ATR(20); 

for( i = 0; i < BarCount; i++ ) 
{ 
//if( Buy[i] ) PlotText( "Buy\n@" + C[ i ]+"\n sl :"+ValueWhen( supbase==Base, LLV(L,HHVperiod) ) , i, L[ i ]-dist[i], colorBlack,colorGreen ); 
//if( Short[i] ) PlotText( "Sell\n@" + C[ i ]+"\n sl :"+ ValueWhen( ResBase==Base, HHV(H,HHVperiod) ), i, H[ i ]+dist[i], colorBlack, colorRed ); 
if( Buy[i] ) PlotText( "@" + C[ i ] , i, L[ i ]-dist[i], colorBlack,colorWhite ); 
if( Short[i] ) PlotText( "@" + C[ i ], i, H[ i ]+dist[i], colorBlack, colorWhite ); 


} 


t1= Flip(Buy,Sell);
t2= Flip(Sell,Buy);
BPrice=ValueWhen(t1 AND Ref(t1,-1)==0,C,1);
SPrice=ValueWhen(t2 AND Ref(t2,-1)==0,C,1);

Buyplus1=(Bprice*1.008);
Buyplus2=(Bprice+80);
Buyminus=(Bprice*0.995);
//Plot(Buyplus1,"R1",colorGreen);
//Plot(Buyplus2,"R1",colorBlue,styleDots|styleThick|styleNoTitle);
//Plot(Buyminus,"R2",colorGreen);

Sellplus=(Sprice*1.005);
Sellminus1=(Sprice*0.992);
Sellminus2=(Sprice-80);
//Plot(Sellplus,"R3",colorRed);
//Plot(Sellminus1,"R4",colorRed);
//Plot(Sellminus2,"R4",colorBlack,styleDots|styleThick|styleNoTitle);
//AlertIf( Buy, "EMAIL", "Buy NMA @  "+Bprice+" "+FullName() , 1, flags = 12, Lookback = 100 );
//AlertIf( Sell, "EMAIL", "Sell NMA @ "+SPrice+" "+FullName() , 2, flags = 12, Lookback = 100 );


PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorBlack, colorBlack ) );
GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 2, 15, 125, 55, 9, 9 ) ;
GfxSelectFont("Courier New", 8, 700 ); 
GfxTextOut("L   I  N   K   O  N", 5, 17);
//GfxTextOut((WriteIf(Buy ,  "Last Buy Trigger at  : "+C+" ", "")), 25, 35);
//GfxTextOut((WriteIf(Sell ,  "Last Sell Trigger at  : "+C+" ", "")), 25, 40);
GfxTextOut("C P   :  " + C, 5, 27);
GfxTextOut("" +Date() , 5, 37);



_SECTION_END();

_SECTION_BEGIN("Time Left"); 
function GetSecondNum()
{
    Time 		= Now( 4 );
    Seconds 	= int( Time % 100 );
    Minutes 	= int( Time / 100 % 100 );
    Hours 	= int( Time / 10000 % 100 );
    SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
    return SecondNum;
}
RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;

x=Param("xposn",918,0,1000,1);
y=Param("yposn",586,0,1000,1);

GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) );
GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 ); 
if ( NewPeriod )
{
   	GfxSelectSolidBrush( colorYellow );
	GfxSelectPen( colorYellow, 2 );  
	Say( "New period" );  
}
GfxRoundRect( x+55, y+17, x-4, y-2, 0, 0 );
GfxSetBkMode(1); 
GfxSelectFont( "Arial", 9, 700, False );
GfxSetTextColor( colorBlack );
GfxTextOut(  ""+SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
_SECTION_END();

B1 = Param("Current Signal", 5148.06,0,6500,0,0);
//Plot( B1+100,"R1",colorGreen,styleDashed); 
//Plot( B1-100,"R1",colorBlack,styleDashed); 
//Plot( B1+50,"R1",colorGreen,styleDashed); 
//Plot( B1-50,"R1",colorBlack,styleDashed); 
//Plot( B1+150,"R1",colorGreen,styleDashed); 
//Plot( B1-150,"R1",colorBlack,styleDashed);
-
-
6th in the list
Name of AFL = Frac 7
Already posted


-
-
-
7th in the list
Name of AFL = NMA
TF = 7 min
Parameters = 5 & 13


HTML:
_SECTION_BEGIN("NICK MA Swing");
SetBarsRequired(200,0);
//Title = ("N   M   A \n" + Name()+"  " + Date() +"  "+Interval(2) +" \n"+ EncodeColor(colorBlack)+"Open "+Open +" ,High "+H+" ,Low "+L+" ,Close "+C+" "+"{{VALUES}}");

GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k =  Optimize("K",Param("K",1,0.25,5,0.25),0.25,5,0.25);
Per= Optimize("atr",Param("atr",4,3,20,1),3,20,1);
HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose,  -1 ),  0.5 );
HaHigh = Max( H,  Max( HaClose,  HaOpen ) );
HaLow = Min( L,  Min( HaClose,  HaOpen ) );
SetChartBkGradientFill( ParamColor("Inner panel upper",colorWhite),ParamColor("Inner panel lower",colorLightYellow));
//PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorBlack, styleCandle | styleNoLabel );
j=Haclose;
grid_day = IIf(Day()!=Ref(Day(),-1),1,0);  
Plot(grid_day,"",colorDarkGrey,styleHistogram|styleDashed|styleNoLabel|styleOwnScale);

//=======================================================================================================================
//=========================Indicator==============================================================================================
f=ATR(14);

rfsctor = WMA(H-L, Per);

revers = k * rfsctor;

Trend = 1;  
NW[0] = 0;  


for(i = 1; i < BarCount; i++)
{
 if(Trend[i-1] == 1)                
 {
  if(j[i] < NW[i-1])                 
  {
   Trend[i] = -1;                   
   NW[i] = j[i] + Revers[i];        
  }
  else                              
  {
   Trend[i] = 1;
   if((j[i] - Revers[i]) > NW[i-1])
   {
    NW[i] = j[i] - Revers[i]; 
   }
   else
   {
    NW[i] = NW[i-1];
   }
  } 
 }
 if(Trend[i-1] == -1)               
 {
  if(j[i] > NW[i-1])                
  {
   Trend[i] = 1;                    
   NW[i] = j[i] - Revers[i];        
  }
  else                              
  {
   Trend[i] = -1;
   if((j[i] + Revers[i]) < NW[i-1]) 
   {
    NW[i] = j[i] + Revers[i]; 
   }
   else
   {
    NW[i] = NW[i-1];
   }
  }
 }
}

//===============system================

Plot(NW, "", IIf(Trend == 1, 27, 4), 4);
Buy=Cover=Cross(j,nw);
Sell=Short=Cross(nw,j);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
//=================TITLE================================================================================================
_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator ) 
(
//Title = EncodeColor(colorBlack)+ "NICK MA Swing System" + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorBlack) +
 "  - " + Date() +" - "+"\n" +EncodeColor(colorBlack) +"Op-"+O+"  "+"Hi-"+H+"  "+"Lo-"+L+"  "+
"Cl-"+C+"  "+ "Vol= "+ WriteVal(V)+"\n"+ 
EncodeColor(colorBlack)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+"  ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+"  ","")+"\n"+EncodeColor(colorBlack)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy  , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+ 
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); 
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

dist = 1.0*ATR(20);

for( i = 0; i < BarCount; i++ ) 
{ 
if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen ); 
if( Sell[i] ) PlotText( "Sell\n@" + C[ i ], i, H[ i ]+dist[i], colorRed, colorYellow ); 
} 


t1= Flip(Buy,Sell);
t2= Flip(Sell,Buy);
BPrice=ValueWhen(t1 AND Ref(t1,-1)==0,C,1);
SPrice=ValueWhen(t2 AND Ref(t2,-1)==0,C,1);

Buyplus1=(Bprice*1.008);
Buyplus2=(Bprice+80);
Buyminus=(Bprice*0.995);
//Plot(Buyplus1,"R1",colorGreen);
//Plot(Buyplus2,"R1",colorBlue,styleDots|styleThick|styleNoTitle);
//Plot(Buyminus,"R2",colorGreen);

Sellplus=(Sprice*1.005);
Sellminus1=(Sprice*0.992);
Sellminus2=(Sprice-80);
//Plot(Sellplus,"R3",colorRed);
//Plot(Sellminus1,"R4",colorRed);
//Plot(Sellminus2,"R4",colorBlack,styleDots|styleThick|styleNoTitle);
 


//AlertIf( Buy, "EMAIL", "Buy NMA @  "+Bprice+" "+FullName() , 1, flags = 12, Lookback = 100 );
//AlertIf( Sell, "EMAIL", "Sell NMA @ "+SPrice+" "+FullName() , 2, flags = 12, Lookback = 100 );

_SECTION_END();

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


GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 2, 15, 95, 35, 9, 9 ) ;
GfxSelectFont("romans", 9, 700 ); 
GfxTextOut("NMA  5  13", 5, 18);

GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 100, 15, 200,42, 9, 9 ) ;
GfxSelectFont("romans", 18, 700 ); 
GfxTextOut( ""+C, 110, 13);


GfxSetBkMode(1);
GfxSelectPen( colorBlack, 1, 0) ;
GfxSelectSolidBrush( colorPink ); 
GfxRoundRect( 205, 15, 330, 35, 9, 9 ) ;
GfxSelectFont("romans", 9, 700 ); 
GfxTextOut("" +Date() , 210, 18);

-
-
8th in the list
Name of AFL = Ace Nifty Trading System
TF = 5 min
This is copyrighted AFL
Pls google for details of the system


-
-
9th in the list
Name of AFL = NMA
TF = 15
Parameters = 3.8 and 7.0
Already posted


-
-
10th in the list
Name of the AFL = Super
TF = 15
Parameters = 4 and 3
Already posted






-Enjoy :)-
 
Last edited:

Similar threads