Median lines

sr114

Well-Known Member
#21


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("Shruti's Median afl");

 Plot(C,"Close",IIf(C>O, colorBrightGreen,colorRed),styleBar);

 mH1=MA(H,1);
 mL1=MA(L,1);
 MD1=MA(Median(C,1),3);

 //Plot(mH1,"MA Hi",colorGrey40,styleLine,styleThick);
 //Plot(ml1,"Ma Lo",colorGrey40,styleLine,styleThick); // if wished u can also plot the mas
 Plot(MD1,"Median",colorYellow,styleLine);//[COLOR="Blue"][B]it was commented here by using // - now its uncommented and the plot will occur[/B][/COLOR]

 Buy=Cross(MD1,ml1);//(ml1,md1); // buy
 Sell=Cross(md1,mh1);//(mh1,md1); //sell

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

 //BuyPrice=ValueWhen(Buy,C,1); // L in place of C
 //SellPrice=ValueWhen(Sell,C,1); // H in place of C

 PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), 43, layer = 0,yposition = Low, offset = -20);
 PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), 4, layer = 0, yposition = High, offset = -20); //shapeSmallCircle
 
 Co = TimeFrameGetPrice( "C", inDaily, -1, expandFirst) ;
 Dates = DateTime();

 Title =EncodeColor(colorYellow)+"Shruti's Price PLOT [ by subroto ] "+"\n"+
 EncodeColor(colorWhite)+  Name () + "\n" +Date()+"  "+Interval(2)
 +EncodeColor(colorWhite)+ "\nOp : "+ EncodeColor(colorWhite)+ O + " | "
 +EncodeColor(colorWhite)+ "Hi : "+ EncodeColor(colorWhite)+ H + " | "
 +EncodeColor(colorWhite)+ "Lo : "+ EncodeColor(colorWhite)+ L + " | "
 +EncodeColor(colorWhite)+ "Cls : "+ WriteIf(C> Ref(C, -1),EncodeColor(colorBrightGreen),EncodeColor(colorGold))+ C 
 +EncodeColor(colorWhite)+ "\nVolume : " + EncodeColor(colorWhite)+ WriteVal(V,1.0)+ "\n\n"
 +EncodeColor(colorWhite)+ "\nMA Hi : "+ EncodeColor(colorWhite)+ mh1 + " | "
 +EncodeColor(colorWhite)+ "\nMa Lo : "+ EncodeColor(colorWhite)+ ml1 + " | "
 +EncodeColor(colorWhite)+ "\nMedian : "+ EncodeColor(colorWhite)+ md1 
 +EncodeColor(colorWhite)+ "\n\nLast day LTP : "+ NumToStr(Co,1.2)+"\n"
 +EncodeColor(colorWhite)+ "Close Diff : " + NumToStr((C -Co),1.2);

 _SECTION_END();
u require the median line - i commented it for the better visualization.
the code i revised here - uncommented the plot of median - use this and u will get the plot of median line

rgds
subroto
 

sr114

Well-Known Member
#22
Dear,
Post no 16 code is without median lines. Surely Buy-sell arrows added to it.
I need BUY - SELL CODING WITH MEDIAN LINES.
Thanx you
actually in the code the median plot is commented for better vusual representation.

as we build the system - we are aware of the components the code included - so if it is not viewed means that it is not there. [ example - the engine parts under the car bonnet - we dont know what is there - but if a component is missing the car will not run - so as in the case of the afl]

so please read the codes - if u cant understand read the manual
and u will get the answer

rgds
subroto
 
Last edited:
#23
yes subroto i agree with you but thing is your Buy-sell arrows not matching with


A) Yellow line going out of green from below = buy ,

B) yellow line going out of red from top = Sell

it is giving buy -sell signal after 1-2 bars..

Kindly check ..so asked to give buy-sell arrows with median lines.

Thanx you
 

sr114

Well-Known Member
#24
yes subroto i agree with you but thing is your Buy-sell arrows not matching with


A) Yellow line going out of green from below = buy ,

B) yellow line going out of red from top = Sell

it is giving buy -sell signal after 1-2 bars..

Kindly check ..so asked to give buy-sell arrows with median lines.

Thanx you


look at the shart
 

Similar threads