Your biggest trading problem is stoploss

mastermind007

Well-Known Member
#22
its a daily chart of opto circuit

rgds
subroto
Dear subroto

Please go back to that chart and list out date /price
at which trade started and ended.

I am keen on discovering the difference between ur approach and mine.
 

mastermind007

Well-Known Member
#24
OMG .... How could we all forget this one. This traverses completely from L to R and still going on.



Short call originated on 21 November 2012 and still going strong. Of course, one of the
reason why trail keeps running is I've asked it be compared against low. This way, trade will only terminate if entire candle is above the stop loss.

I've also listed out all parameters and its settings
 

nms

Active Member
#25
Opto Circuit chart (daily mode)



trade date as per scan


rgds
subroto
Dear sr,
I have read yours so many posts. Regarding afl , what I knoe, you are expert in this line. Your above chart looks very nice with simple formulas. I need this afl. Can you kindly post this afl, or otherwise if atall you want my mail id - [email protected] you have no objection, pl.send the same.
Thanks & regards.
 

nms

Active Member
#26
Hi Subroto Sir,
You are helping to others, but why silent for me? Might be buzy with other works.Anyhow awaiting your reply. If any one has this AFL(in post.25) pl.help me.
Thanks
 
Last edited:

sr114

Well-Known Member
#27
Hi Subroto Sir,
You are helping to others, but why silent for me? Might be buzy with other works.Anyhow awaiting your reply. If any one has this AFL(in post.25) pl.help me.
Thanks
here is the afl for u and all other who r interested in this particular afl

Code:
 _SECTION_BEGIN("Background_Setting");
 SetChartBkGradientFill( ParamColor("BgTop", colorBlack),
 ParamColor("BgBottom", colorDarkGrey),ParamColor("TitleBack",colorGrey40)); 
 SetChartBkColor(ParamColor("Outer Panel",colorPaleBlue));
 SetChartOptions(0,chartShowArrows|chartShowDates);
 _SECTION_END();

 _SECTION_BEGIN("Candle color");
 upbar= H > Ref(H,-1) AND L > Ref(L,-1);
 dnbar= H < Ref(H,-1) AND L < Ref(L,-1);
 
 SetBarFillColor(IIf(upbar,ParamColor("Candle UP Color", colorGreen),IIf(dnbar,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
 Plot(C,"Close",IIf(upbar,ParamColor("UP Color", colorDarkGreen),IIf(dnbar,ParamColor("Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);
 _SECTION_END();

_SECTION_BEGIN("Breakout Setting");
 Buyperiods=Param("Long Brkout pds ",5,1,100,1,1);
 Sellperiods=Param("Short Breakout pds",5,1,100,1,1);

 Buy = C> Ref( HHV(H,Buyperiods), -1 )  ;
 Sell= C < Ref(LLV(L,Sellperiods),-1) ;

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

 PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), 43, layer = 0,yposition = Low, offset = -20);
 PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), colorRed, layer = 0, yposition = High, offset = -20); //shapeSmallCircle
 
 GraphXSpace=10;

 _SECTION_END();

 _SECTION_BEGIN("VSTOP ");
// VSTOP&ATR

 // E.M.Pottasch, Jul 2010
 // from Metastock formula, link: http://stocata.org/metastock/stop_trail_atr.html
 // added separate parameters for upward and downward market environment

 function vstop_func(trBull,trBear)
 {
	trailArray[ 0 ] = C[ 0 ]; // initialize
	for( i = 1; i < BarCount; i++ )
	{
		prev = trailArray[ i - 1 ];
 
		if (C[ i ] > prev AND C[ i - 1 ] > prev)
		{
			trailArray[ i ] = Max(prev,C[ i ] - trBull[ i ]);
		}
		else if (C[ i ] < prev AND C[ i - 1 ] < prev)
		{
			trailArray[ i ] = Min(prev,C[ i ] + trBear[ i ]);
		}
		else if (C[ i ] > prev)
		{
			trailArray[ i ] = C[ i ] - trBull[ i ];
		}
		else
		{
			trailArray[ i ] = C[ i ] + trBear[ i ];	
		}
	}
	return trailArray;
 }

 VSTOPATRper = Param("VSTOPper",14,1,50,1,0) ;

 Res = Param("VSTOPMultRes",2,1,10,0.1,0) ;
 Sup = Param("VSTOPMultSup",2,1,10,0.1,0) ;

 trBear = res * ATR(VSTOPatrper);
 trBull = sup  * ATR(VSTOPatrper);

 trailArray = vstop_func(trbull,trbear);

 tsz=0.05;uu=(1/tsz);
 trailArray=round(trailArray * uu)/uu;
 Plot(trailArray,"\nVSTOP",colorGrey50,styleLine|styleThick) ;
 bc = BarCount;
 lineSL = trailArray;
 StartXre = LastValue( ValueWhen( lineSL, 1 ) );
 EndYre = LastValue( ValueWhen( lineSL, lineSL ) );
 PlotText( "Tr.SL. = " + NumToStr(EndYre,1.2) , bc + 1, EndYre , colorWhite, colorBlue);

 _SECTION_END();

 _SECTION_BEGIN("Title");

 Dates = DateTime();
 Title =  EncodeColor(colorWhite)+"Trading System Ver 1.0 [ Subroto ~ 29/03/2013 ] " + "\n"+ Name () + " / "
 +EncodeColor(colorWhite) + Date() + " , "+  Interval(2)+"\n" 
 +EncodeColor(colorWhite)+ "Open ~ "+ EncodeColor(colorWhite)+ O + " | "
 +EncodeColor(colorWhite)+ "High ~ "+ EncodeColor(colorWhite)+ H + " | "
 +EncodeColor(colorWhite)+ "Low ~ "+ EncodeColor(colorWhite)+ L + " \n"
 +EncodeColor(colorWhite)+ "Close ~ "+ WriteIf(C> Ref(C, -1),EncodeColor(colorBrightGreen),EncodeColor(colorGold))+ C + " | "
 +EncodeColor(colorWhite)+ "Change ~ INR "+ WriteIf(C> Ref(C, -1),EncodeColor(colorBrightGreen),EncodeColor(colorGold)) + WriteVal(C-Ref(C,-1),1.2)+" ."
 +EncodeColor(colorWhite)+ " / "+ WriteIf(C> Ref(C, -1),EncodeColor(colorBrightGreen),EncodeColor(colorGold))+ WriteVal( ROC( C, 1 ),1.2)+""+ " % "
 +EncodeColor(colorWhite)+ "\nVolume : " + EncodeColor(colorWhite)+ NumToStr(V,1.0)+ "\n\n"
 +EncodeColor(colorBrightGreen)+ "Last Buy was on = " + WriteVal(ValueWhen(Buy, Dates, 1), formatDateTime)+" \n@ Rs."+ WriteVal(BuyPrice,1.2)+"\n\n" 
 +EncodeColor(colorYellow)+ "Last Sell was on = " + WriteVal(ValueWhen(Sell, Dates, 1), formatDateTime)+" \n@ Rs."+ WriteVal(SellPrice,1.2)+"\n\n";


_SECTION_END();
screen shot


rgds
subroto
 
#30
hi subroto

Thank you for the main code.
What I have done is nothing and a minor change.

the changed lines are here.
HTML:
VSTOPCOLOR = IIf(C>trailArray,colorRed,IIf(C<trailArray,colorYellow,colorGrey50));
 Plot(trailArray,"\nVSTOP",VSTOPCOLOR,styleThick) ;
Regards
 

Similar threads